]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
blk-wbt: Optimize wbt_done() for non-throttled writes
authorTang Yizhou <yizhou.tang@shopee.com>
Sun, 27 Jul 2025 17:39:57 +0000 (01:39 +0800)
committerJens Axboe <axboe@kernel.dk>
Mon, 11 Aug 2025 16:21:38 +0000 (10:21 -0600)
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>
block/blk-wbt.c

index a50d4cd55f419c2c5d104fb1c9b017f52ec7b561..30886d44f6cd253157cb0fa850d1d94fb0322f94 100644 (file)
@@ -248,13 +248,14 @@ static void wbt_done(struct rq_qos *rqos, struct request *rq)
        struct rq_wb *rwb = RQWB(rqos);
 
        if (!wbt_is_tracked(rq)) {
-               if (rwb->sync_cookie == rq) {
-                       rwb->sync_issue = 0;
-                       rwb->sync_cookie = NULL;
-               }
+               if (wbt_is_read(rq)) {
+                       if (rwb->sync_cookie == rq) {
+                               rwb->sync_issue = 0;
+                               rwb->sync_cookie = NULL;
+                       }
 
-               if (wbt_is_read(rq))
                        wb_timestamp(rwb, &rwb->last_comp);
+               }
        } else {
                WARN_ON_ONCE(rq == rwb->sync_cookie);
                __wbt_done(rqos, wbt_flags(rq));