]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ublk: call ublk_dispatch_req() for handling UBLK_U_IO_NEED_GET_DATA
authorMing Lei <ming.lei@redhat.com>
Fri, 25 Apr 2025 01:37:39 +0000 (09:37 +0800)
committerJens Axboe <axboe@kernel.dk>
Fri, 25 Apr 2025 01:52:20 +0000 (19:52 -0600)
We call io_uring_cmd_complete_in_task() to schedule task_work for handling
UBLK_U_IO_NEED_GET_DATA.

This way is really not necessary because the current context is exactly
the ublk queue context, so call ublk_dispatch_req() directly for handling
UBLK_U_IO_NEED_GET_DATA.

Fixes: 216c8f5ef0f2 ("ublk: replace monitor with cancelable uring_cmd")
Tested-by: Jared Holzman <jholzman@nvidia.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20250425013742.1079549-2-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/ublk_drv.c

index 2de7b2bd409ddfdc1e9bad68cd942ec0bca7af07..c4d4be4f6fbdaa42d4fe3a348a330fdee693801f 100644 (file)
@@ -1886,15 +1886,6 @@ static void ublk_mark_io_ready(struct ublk_device *ub, struct ublk_queue *ubq)
        }
 }
 
-static void ublk_handle_need_get_data(struct ublk_device *ub, int q_id,
-               int tag)
-{
-       struct ublk_queue *ubq = ublk_get_queue(ub, q_id);
-       struct request *req = blk_mq_tag_to_rq(ub->tag_set.tags[q_id], tag);
-
-       ublk_queue_cmd(ubq, req);
-}
-
 static inline int ublk_check_cmd_op(u32 cmd_op)
 {
        u32 ioc_type = _IOC_TYPE(cmd_op);
@@ -2103,8 +2094,9 @@ static int __ublk_ch_uring_cmd(struct io_uring_cmd *cmd,
                if (!(io->flags & UBLK_IO_FLAG_OWNED_BY_SRV))
                        goto out;
                ublk_fill_io_cmd(io, cmd, ub_cmd->addr);
-               ublk_handle_need_get_data(ub, ub_cmd->q_id, ub_cmd->tag);
-               break;
+               req = blk_mq_tag_to_rq(ub->tag_set.tags[ub_cmd->q_id], tag);
+               ublk_dispatch_req(ubq, req, issue_flags);
+               return -EIOCBQUEUED;
        default:
                goto out;
        }