Commit 42a6bd57 authored by Caleb Sander Mateos's avatar Caleb Sander Mateos Committed by Jens Axboe
Browse files

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: 1cba30bf ("io_uring: add support for IORING_SETUP_SQE_MIXED")
Signed-off-by: default avatarCaleb Sander Mateos <csander@purestorage.com>
Reviewed-by: default avatarAnuj Gupta <anuj20.g@samsung.com>
Reviewed-by: default avatarKanchan Joshi <joshi.k@samsung.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 003049b1
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -530,6 +530,12 @@ static inline bool io_file_can_poll(struct io_kiocb *req)
	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)
+1 −1
Original line number Diff line number Diff line
@@ -171,7 +171,7 @@ static bool io_should_commit(struct io_kiocb *req, unsigned int issue_flags)
		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;
}
+2 −2
Original line number Diff line number Diff line
@@ -1254,7 +1254,7 @@ static int io_uring_classic_poll(struct io_kiocb *req, struct io_comp_batch *iob
{
	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);
@@ -1380,7 +1380,7 @@ int io_do_iopoll(struct io_ring_ctx *ctx, bool force_nonspin)
		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)