]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ublk: don't access ublk_queue in ublk_check_fetch_buf()
authorCaleb Sander Mateos <csander@purestorage.com>
Thu, 18 Sep 2025 01:49:47 +0000 (19:49 -0600)
committerJens Axboe <axboe@kernel.dk>
Sat, 20 Sep 2025 12:36:27 +0000 (06:36 -0600)
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>
drivers/block/ublk_drv.c

index cb61f62139622b074d62b748de6f773178d59489..9c6045e6d03bf8cedceee827bba3b700a2ba6cf7 100644 (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);