]> www.infradead.org Git - users/hch/misc.git/commitdiff
ublk: remove unnecessary ubq checks
authorCaleb Sander Mateos <csander@purestorage.com>
Wed, 16 Apr 2025 17:01:53 +0000 (11:01 -0600)
committerJens Axboe <axboe@kernel.dk>
Wed, 23 Apr 2025 02:09:12 +0000 (20:09 -0600)
ublk_init_queues() ensures that all nr_hw_queues queues are initialized,
with each ublk_queue's q_id set to its index. And ublk_init_queues() is
called before ublk_add_chdev(), which creates the cdev. Is is therefore
impossible for the !ubq || ub_cmd->q_id != ubq->q_id condition to hit in
__ublk_ch_uring_cmd(). Remove it to avoids some branches in the I/O path.

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

index 03653bd7a1dfd69f5545a580dbc74de9d850c0ae..2f5f58774e1535fa7817d96e93de754839b130dd 100644 (file)
@@ -2035,9 +2035,6 @@ static int __ublk_ch_uring_cmd(struct io_uring_cmd *cmd,
                goto out;
 
        ubq = ublk_get_queue(ub, ub_cmd->q_id);
-       if (!ubq || ub_cmd->q_id != ubq->q_id)
-               goto out;
-
        if (ubq->ubq_daemon && ubq->ubq_daemon != current)
                goto out;