Skip to content

Commit d6aa0c1

Browse files
Ming Leiaxboe
authored andcommitted
ublk: call ublk_dispatch_req() for handling UBLK_U_IO_NEED_GET_DATA
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: 216c8f5 ("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>
1 parent c4d2519 commit d6aa0c1

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

drivers/block/ublk_drv.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1886,15 +1886,6 @@ static void ublk_mark_io_ready(struct ublk_device *ub, struct ublk_queue *ubq)
18861886
}
18871887
}
18881888

1889-
static void ublk_handle_need_get_data(struct ublk_device *ub, int q_id,
1890-
int tag)
1891-
{
1892-
struct ublk_queue *ubq = ublk_get_queue(ub, q_id);
1893-
struct request *req = blk_mq_tag_to_rq(ub->tag_set.tags[q_id], tag);
1894-
1895-
ublk_queue_cmd(ubq, req);
1896-
}
1897-
18981889
static inline int ublk_check_cmd_op(u32 cmd_op)
18991890
{
19001891
u32 ioc_type = _IOC_TYPE(cmd_op);
@@ -2103,8 +2094,9 @@ static int __ublk_ch_uring_cmd(struct io_uring_cmd *cmd,
21032094
if (!(io->flags & UBLK_IO_FLAG_OWNED_BY_SRV))
21042095
goto out;
21052096
ublk_fill_io_cmd(io, cmd, ub_cmd->addr);
2106-
ublk_handle_need_get_data(ub, ub_cmd->q_id, ub_cmd->tag);
2107-
break;
2097+
req = blk_mq_tag_to_rq(ub->tag_set.tags[ub_cmd->q_id], tag);
2098+
ublk_dispatch_req(ubq, req, issue_flags);
2099+
return -EIOCBQUEUED;
21082100
default:
21092101
goto out;
21102102
}

0 commit comments

Comments
 (0)