Skip to content

Commit d8b96a7

Browse files
Tang Yizhouaxboe
authored andcommitted
blk-wbt: Optimize wbt_done() for non-throttled writes
In the current implementation, the sync_cookie and last_cookie members of struct rq_wb are used only by read requests and not by non-throttled write requests. Based on this, we can optimize wbt_done() by removing one if condition check for non-throttled write requests. Signed-off-by: Tang Yizhou <yizhou.tang@shopee.com> Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: Yu Kuai <yukuai3@huawei.com> Link: https://lore.kernel.org/r/20250727173959.160835-2-yizhou.tang@shopee.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 343dc54 commit d8b96a7

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

block/blk-wbt.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -248,13 +248,14 @@ static void wbt_done(struct rq_qos *rqos, struct request *rq)
248248
struct rq_wb *rwb = RQWB(rqos);
249249

250250
if (!wbt_is_tracked(rq)) {
251-
if (rwb->sync_cookie == rq) {
252-
rwb->sync_issue = 0;
253-
rwb->sync_cookie = NULL;
254-
}
251+
if (wbt_is_read(rq)) {
252+
if (rwb->sync_cookie == rq) {
253+
rwb->sync_issue = 0;
254+
rwb->sync_cookie = NULL;
255+
}
255256

256-
if (wbt_is_read(rq))
257257
wb_timestamp(rwb, &rwb->last_comp);
258+
}
258259
} else {
259260
WARN_ON_ONCE(rq == rwb->sync_cookie);
260261
__wbt_done(rqos, wbt_flags(rq));

0 commit comments

Comments
 (0)