]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ublk: don't dereference ublk_queue in ublk_check_and_get_req()
authorCaleb Sander Mateos <csander@purestorage.com>
Thu, 18 Sep 2025 01:49:42 +0000 (19:49 -0600)
committerJens Axboe <axboe@kernel.dk>
Sat, 20 Sep 2025 12:36:27 +0000 (06:36 -0600)
For ublk servers with many ublk queues, accessing the ublk_queue in
ublk_ch_{read,write}_iter() is a frequent cache miss. Get the flags and
queue depth from the ublk_device instead, which is accessed just before.

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

index 58f688eac7420ac778e1fabc523836f6923b8ff4..d6d8dcb72e4bb58461fcef4f9a589ec1a1338bde 100644 (file)
@@ -2527,10 +2527,10 @@ static struct request *ublk_check_and_get_req(struct kiocb *iocb,
                return ERR_PTR(-EINVAL);
 
        ubq = ublk_get_queue(ub, q_id);
-       if (!ublk_support_user_copy(ubq))
+       if (!ublk_dev_support_user_copy(ub))
                return ERR_PTR(-EACCES);
 
-       if (tag >= ubq->q_depth)
+       if (tag >= ub->dev_info.queue_depth)
                return ERR_PTR(-EINVAL);
 
        *io = &ubq->ios[tag];