Skip to content

Commit 42a6bd5

Browse files
calebsanderaxboe
authored andcommitted
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. Fixes: 1cba30b ("io_uring: add support for IORING_SETUP_SQE_MIXED") Signed-off-by: Caleb Sander Mateos <csander@purestorage.com> Reviewed-by: Anuj Gupta <anuj20.g@samsung.com> Reviewed-by: Kanchan Joshi <joshi.k@samsung.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 003049b commit 42a6bd5

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

io_uring/io_uring.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,12 @@ static inline bool io_file_can_poll(struct io_kiocb *req)
530530
return false;
531531
}
532532

533+
static inline bool io_is_uring_cmd(const struct io_kiocb *req)
534+
{
535+
return req->opcode == IORING_OP_URING_CMD ||
536+
req->opcode == IORING_OP_URING_CMD128;
537+
}
538+
533539
static inline ktime_t io_get_time(struct io_ring_ctx *ctx)
534540
{
535541
if (ctx->clockid == CLOCK_MONOTONIC)

io_uring/kbuf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ static bool io_should_commit(struct io_kiocb *req, unsigned int issue_flags)
171171
return true;
172172

173173
/* uring_cmd commits kbuf upfront, no need to auto-commit */
174-
if (!io_file_can_poll(req) && req->opcode != IORING_OP_URING_CMD)
174+
if (!io_file_can_poll(req) && !io_is_uring_cmd(req))
175175
return true;
176176
return false;
177177
}

io_uring/rw.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,7 +1254,7 @@ static int io_uring_classic_poll(struct io_kiocb *req, struct io_comp_batch *iob
12541254
{
12551255
struct file *file = req->file;
12561256

1257-
if (req->opcode == IORING_OP_URING_CMD) {
1257+
if (io_is_uring_cmd(req)) {
12581258
struct io_uring_cmd *ioucmd;
12591259

12601260
ioucmd = io_kiocb_to_cmd(req, struct io_uring_cmd);
@@ -1380,7 +1380,7 @@ int io_do_iopoll(struct io_ring_ctx *ctx, bool force_nonspin)
13801380
wq_list_add_tail(&req->comp_list, &ctx->submit_state.compl_reqs);
13811381
nr_events++;
13821382
req->cqe.flags = io_put_kbuf(req, req->cqe.res, NULL);
1383-
if (req->opcode != IORING_OP_URING_CMD)
1383+
if (!io_is_uring_cmd(req))
13841384
io_req_rw_cleanup(req, 0);
13851385
}
13861386
if (nr_events)

0 commit comments

Comments
 (0)