ublk: return early if blk_should_fake_timeout()

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>
This commit is contained in:
Caleb Sander Mateos 2025-06-20 09:10:04 -06:00 committed by Jens Axboe
parent 763ff02ce2
commit 7ab741081b

View 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;
}