From: Caleb Sander Mateos Date: Thu, 18 Sep 2025 01:49:42 +0000 (-0600) Subject: ublk: don't dereference ublk_queue in ublk_check_and_get_req() X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=b40dcdf8235d536072b9f61eb6d291f0f3720768;p=users%2Fhch%2Fmisc.git ublk: don't dereference ublk_queue in ublk_check_and_get_req() 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 Reviewed-by: Ming Lei Signed-off-by: Jens Axboe --- diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c index 58f688eac742..d6d8dcb72e4b 100644 --- a/drivers/block/ublk_drv.c +++ b/drivers/block/ublk_drv.c @@ -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];