io_uring: add IORING_OP_URING_CMD128 to opcode checks
PATCH 1/1 io_uring: add IORING_OP_URING_CMD128 to opcode checks
io_should_commit(), io_uring_classic_poll(), and io_do_iopoll() compare struct io_kiocb's opcode against IORING_OP_URING_CMD to implement special treatment for uring_cmds. The recently added opcode IORING_OP_URING_CMD128 is meant to be equivalent to IORING_OP_URING_CMD, so treat it the same way in these functions.
--- io_uring/io_uring.h | 6 ++++++ io_uring/kbuf.c | 2 +- io_uring/rw.c | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-)
io_uring/io_uring.h +6 -0
@@ -528,10 +528,16 @@ static inline bool io_file_can_poll(struct io_kiocb *req)return true; }return false; } +static inline bool io_is_uring_cmd (const struct io_kiocb *req) +{ +return req->opcode ==IORING_OP_URING_CMD || + req->opcode ==IORING_OP_URING_CMD128 ; +} +static inline ktime_t io_get_time (struct io_ring_ctx *ctx) {if (ctx->clockid ==CLOCK_MONOTONIC )return ktime_get ();
io_uring/kbuf.c +1 -1
@@ -169,11 +169,11 @@ static bool io_should_commit(struct io_kiocb *req, unsigned int issue_flags)*/ if (issue_flags &IO_URING_F_UNLOCKED )return true;/* uring_cmd commits kbuf upfront, no need to auto-commit */ -if (!io_file_can_poll (req) && req->opcode !=IORING_OP_URING_CMD ) +if (!io_file_can_poll (req) && !io_is_uring_cmd (req))return true;return false; } static struct io_br_sel io_ring_buffer_select(struct io_kiocb *req, size_t *len,
io_uring/rw.c +2 -2
@@ -1252,11 +1252,11 @@ void io_rw_fail(struct io_kiocb *req)static int io_uring_classic_poll (struct io_kiocb *req,struct io_comp_batch *iob,unsigned int poll_flags) {struct file *file = req->file; -if (req->opcode ==IORING_OP_URING_CMD ) { +if (io_is_uring_cmd (req)) {struct io_uring_cmd *ioucmd; ioucmd = io_kiocb_to_cmd(req, struct io_uring_cmd);return file->f_op->uring_cmd_iopoll (ioucmd, iob, poll_flags); }else {
@@ -1378,11 +1378,11 @@ int io_do_iopoll(struct io_ring_ctx *ctx, bool force_nonspin)continue ;list_del (&req->iopoll_node);wq_list_add_tail (&req->comp_list, &ctx->submit_state.compl_reqs); nr_events++; req->cqe.flags =io_put_kbuf (req, req->cqe.res,NULL ); -if (req->opcode !=IORING_OP_URING_CMD ) +if (!io_is_uring_cmd (req))io_req_rw_cleanup (req,0 ); }if (nr_events)__io_submit_flush_completions (ctx);return nr_events;
Signature · 1 line
2.45.2
Quoted 8 lines · Caleb Sander Mateos
io_should_commit(),io_uring_classic_poll(), andio_do_iopoll()compare struct io_kiocb's opcode againstIORING_OP_URING_CMDto implement special treatment foruring_cmds. The recently added opcodeIORING_OP_URING_CMD128is meant to be equivalent toIORING_OP_URING_CMD, so treat it the same way in these functions.Fixes 1cba30bf9fdd ("io_uring: add support for IORING_SETUP_SQE_MIXED")Signed-off-by Caleb Sander Mateos<[email protected]>
Quoted 8 lines · Caleb Sander Mateos
io_should_commit(),io_uring_classic_poll(), andio_do_iopoll()compare struct io_kiocb's opcode againstIORING_OP_URING_CMDto implement special treatment foruring_cmds. The recently added opcodeIORING_OP_URING_CMD128is meant to be equivalent toIORING_OP_URING_CMD, so treat it the same way in these functions.[...]
Applied, thanks!
[1/1] io_uring: add IORING_OP_URING_CMD128 to opcode checks
commit: 42a6bd57ee9f930a72c26f863c72f666d6ed9ea5
Best regards,
Signature · 1 line
Jens Axboe
Quoted 7 lines · Caleb Sander Mateos
io_should_commit(),io_uring_classic_poll(), andio_do_iopoll()compare struct io_kiocb's opcode againstIORING_OP_URING_CMDto implement special treatment foruring_cmds. The recently added opcodeIORING_OP_URING_CMD128is meant to be equivalent toIORING_OP_URING_CMD, so treat it the same way in these functions.Fixes 1cba30bf9fdd ("io_uring: add support for IORING_SETUP_SQE_MIXED")
Looks good, thanks for the fix.