]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ublk: return early if blk_should_fake_timeout()
authorCaleb Sander Mateos <csander@purestorage.com>
Fri, 20 Jun 2025 15:10:04 +0000 (09:10 -0600)
committerJens Axboe <axboe@kernel.dk>
Tue, 1 Jul 2025 02:13:42 +0000 (20:13 -0600)
Make the unlikely case blk_should_fake_timeout() return early to reduce
the indentation of the successful path.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20250620151008.3976463-11-csander@purestorage.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/ublk_drv.c

index fa1859c062115c371ef18470f745ecf4c63544ab..08a83aa8a993fbfbadfa1555ff58ec983851a073 100644 (file)
@@ -2161,9 +2161,10 @@ static int ublk_commit_and_fetch(const struct ublk_queue *ubq,
        if (req_op(req) == REQ_OP_ZONE_APPEND)
                req->__sector = ub_cmd->zone_append_lba;
 
-       if (likely(!blk_should_fake_timeout(req->q)))
-               ublk_put_req_ref(ubq, io, req);
+       if (unlikely(blk_should_fake_timeout(req->q)))
+               return 0;
 
+       ublk_put_req_ref(ubq, io, req);
        return 0;
 }