summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaleb Sander Mateos <csander@purestorage.com>2025-06-20 09:10:04 -0600
committerJens Axboe <axboe@kernel.dk>2025-06-30 20:13:42 -0600
commit7ab741081be307e3ec5dc8ed55ed8fc0f5b2a0e3 (patch)
treeca704a2d5466e6e3341b4ea95eb8332b0a712ce1
parent763ff02ce287c2e5c8a012d40bd2f3dab99ae5d5 (diff)
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>
-rw-r--r--drivers/block/ublk_drv.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c
index fa1859c06211..08a83aa8a993 100644
--- a/drivers/block/ublk_drv.c
+++ b/drivers/block/ublk_drv.c
@@ -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;
}