ublk: don't access ublk_queue in ublk_check_fetch_buf()

Obtain the ublk device flags from ublk_device to avoid needing to access
the ublk_queue, which may be a cache miss.

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>
This commit is contained in:
Caleb Sander Mateos 2025-09-17 19:49:47 -06:00 committed by Jens Axboe
parent 25c028aa79
commit a689efd5fd
1 changed files with 4 additions and 4 deletions

View File

@ -2190,14 +2190,14 @@ static int ublk_unregister_io_buf(struct io_uring_cmd *cmd,
return io_buffer_unregister_bvec(cmd, index, issue_flags);
}
static int ublk_check_fetch_buf(const struct ublk_queue *ubq, __u64 buf_addr)
static int ublk_check_fetch_buf(const struct ublk_device *ub, __u64 buf_addr)
{
if (ublk_need_map_io(ubq)) {
if (ublk_dev_need_map_io(ub)) {
/*
* FETCH_RQ has to provide IO buffer if NEED GET
* DATA is not enabled
*/
if (!buf_addr && !ublk_need_get_data(ubq))
if (!buf_addr && !ublk_dev_need_get_data(ub))
return -EINVAL;
} else if (buf_addr) {
/* User copy requires addr to be unset */
@ -2340,7 +2340,7 @@ static int ublk_ch_uring_cmd_local(struct io_uring_cmd *cmd,
io = &ubq->ios[tag];
/* UBLK_IO_FETCH_REQ can be handled on any task, which sets io->task */
if (unlikely(_IOC_NR(cmd_op) == UBLK_IO_FETCH_REQ)) {
ret = ublk_check_fetch_buf(ubq, addr);
ret = ublk_check_fetch_buf(ub, addr);
if (ret)
goto out;
ret = ublk_fetch(cmd, ubq, io, addr);