Skip to content

Commit de383e3

Browse files
author
Ming Lei
committed
io_uring: enable per-io write streams
JIRA: https://issues.redhat.com/browse/RHEL-122870 commit 0204035 Author: Keith Busch <kbusch@kernel.org> Date: Tue May 6 17:47:27 2025 +0530 io_uring: enable per-io write streams Allow userspace to pass a per-I/O write stream in the SQE: __u8 write_stream; The __u8 type matches the size the filesystems and block layer support. Application can query the supported values from the block devices max_write_streams sysfs attribute. Unsupported values are ignored by file operations that do not support write streams or rejected with an error by those that support them. Reviewed-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Nitesh Shetty <nj.shetty@samsung.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Keith Busch <kbusch@kernel.org> Signed-off-by: Kanchan Joshi <joshi.k@samsung.com> Link: https://lore.kernel.org/r/20250506121732.8211-7-joshi.k@samsung.com Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Ming Lei <ming.lei@redhat.com>
1 parent c3d5212 commit de383e3

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

include/uapi/linux/io_uring.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ struct io_uring_sqe {
9292
__u16 addr_len;
9393
__u16 __pad3[1];
9494
};
95+
struct {
96+
__u8 write_stream;
97+
__u8 __pad4[3];
98+
};
9599
};
96100
union {
97101
struct {

io_uring/io_uring.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3895,6 +3895,8 @@ static int __init io_uring_init(void)
38953895
BUILD_BUG_SQE_ELEM(44, __s32, splice_fd_in);
38963896
BUILD_BUG_SQE_ELEM(44, __u32, file_index);
38973897
BUILD_BUG_SQE_ELEM(44, __u16, addr_len);
3898+
BUILD_BUG_SQE_ELEM(44, __u8, write_stream);
3899+
BUILD_BUG_SQE_ELEM(45, __u8, __pad4[0]);
38983900
BUILD_BUG_SQE_ELEM(46, __u16, __pad3[0]);
38993901
BUILD_BUG_SQE_ELEM(48, __u64, addr3);
39003902
BUILD_BUG_SQE_ELEM_SIZE(48, 0, cmd);

io_uring/rw.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ static int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe,
291291
}
292292
rw->kiocb.dio_complete = NULL;
293293
rw->kiocb.ki_flags = 0;
294+
rw->kiocb.ki_write_stream = READ_ONCE(sqe->write_stream);
294295

295296
if (req->ctx->flags & IORING_SETUP_IOPOLL)
296297
rw->kiocb.ki_complete = io_complete_rw_iopoll;

0 commit comments

Comments
 (0)