Skip to content

Commit 733c43f

Browse files
calebsanderaxboe
authored andcommitted
io_uring/cmd: introduce IORING_URING_CMD_REISSUE flag
Add a flag IORING_URING_CMD_REISSUE that ->uring_cmd() implementations can use to tell whether this is the first or subsequent issue of the uring_cmd. This will allow ->uring_cmd() implementations to store information in the io_uring_cmd's pdu across issues. Signed-off-by: Caleb Sander Mateos <[email protected]> Acked-by: David Sterba <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 262ab20 commit 733c43f

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

include/linux/io_uring/cmd.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
/* only top 8 bits of sqe->uring_cmd_flags for kernel internal use */
1010
#define IORING_URING_CMD_CANCELABLE (1U << 30)
11+
/* io_uring_cmd is being issued again */
12+
#define IORING_URING_CMD_REISSUE (1U << 31)
1113

1214
struct io_uring_cmd {
1315
struct file *file;

io_uring/uring_cmd.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,11 @@ int io_uring_cmd(struct io_kiocb *req, unsigned int issue_flags)
261261
}
262262

263263
ret = file->f_op->uring_cmd(ioucmd, issue_flags);
264-
if (ret == -EAGAIN || ret == -EIOCBQUEUED)
264+
if (ret == -EAGAIN) {
265+
ioucmd->flags |= IORING_URING_CMD_REISSUE;
266+
return ret;
267+
}
268+
if (ret == -EIOCBQUEUED)
265269
return ret;
266270
if (ret < 0)
267271
req_set_fail(req);

0 commit comments

Comments
 (0)