summaryrefslogtreecommitdiff
path: root/io_uring
diff options
context:
space:
mode:
authorCaleb Sander Mateos <csander@purestorage.com>2026-02-18 18:35:34 -0700
committerSasha Levin <sashal@kernel.org>2026-03-04 07:19:30 -0500
commitb537e63b7a0c93557698ffae020c44351f0f639e (patch)
tree0c55a9ed4a55331bf75f5c4559551c0037811f96 /io_uring
parent3975f76ab9009a1a70aee3c4e67e0932ebb47738 (diff)
downloadlinux-b537e63b7a0c93557698ffae020c44351f0f639e.tar.gz
linux-b537e63b7a0c93557698ffae020c44351f0f639e.tar.bz2
linux-b537e63b7a0c93557698ffae020c44351f0f639e.zip
io_uring: add IORING_OP_URING_CMD128 to opcode checks
[ Upstream commit 42a6bd57ee9f930a72c26f863c72f666d6ed9ea5 ] 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: 1cba30bf9fdd ("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'io_uring')
-rw-r--r--io_uring/io_uring.h6
-rw-r--r--io_uring/kbuf.c2
-rw-r--r--io_uring/rw.c4
3 files changed, 9 insertions, 3 deletions
diff --git a/io_uring/io_uring.h b/io_uring/io_uring.h
index a790c16854d3..0f096f44d34b 100644
--- a/io_uring/io_uring.h
+++ b/io_uring/io_uring.h
@@ -595,6 +595,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)
diff --git a/io_uring/kbuf.c b/io_uring/kbuf.c
index 67d4fe576473..dae5b4ab3819 100644
--- a/io_uring/kbuf.c
+++ b/io_uring/kbuf.c
@@ -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;
}
diff --git a/io_uring/rw.c b/io_uring/rw.c
index 28555bc85ba0..01367ac09531 100644
--- a/io_uring/rw.c
+++ b/io_uring/rw.c
@@ -1253,7 +1253,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);
@@ -1376,7 +1376,7 @@ int io_do_iopoll(struct io_ring_ctx *ctx, bool force_nonspin)
break;
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 (unlikely(!nr_events))