public inbox for fio@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] engine/io_uring: add write stream support
@ 2024-12-11 18:44 Keith Busch
  2024-12-11 19:10 ` fiotestbot
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Keith Busch @ 2024-12-11 18:44 UTC (permalink / raw)
  To: fio, vincent.fu, axboe; +Cc: Keith Busch

From: Keith Busch <kbusch@kernel.org>

Let a user specify a write stream specific to each job. You can check
the block device's max_write_streams sysfs queue attribute for the valid
range of stream values.

Signed-off-by: Keith Busch <kbusch@kernel.org>
---
This depends on the kernel side supporting this feature. The latest is
here, which I *think* appears to have stablized on the API.

  https://lore.kernel.org/io-uring/20241210194722.1905732-1-kbusch@meta.com/T/#u

 engines/io_uring.c  | 18 ++++++++++++++++--
 os/linux/io_uring.h |  4 ++++
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/engines/io_uring.c b/engines/io_uring.c
index facc967f..edb6af37 100644
--- a/engines/io_uring.c
+++ b/engines/io_uring.c
@@ -104,6 +104,7 @@ struct ioring_options {
 	unsigned int hipri;
 	unsigned int readfua;
 	unsigned int writefua;
+	unsigned int write_stream;
 	unsigned int deac;
 	unsigned int write_mode;
 	unsigned int verify_mode;
@@ -174,6 +175,16 @@ static struct fio_option options[] = {
 		.category = FIO_OPT_C_ENGINE,
 		.group	= FIO_OPT_G_IOURING,
 	},
+	{
+		.name	= "write_stream",
+		.lname	= "Tag write commands with this write stream index",
+		.type	= FIO_OPT_INT,
+		.off1	= offsetof(struct ioring_options, write_stream),
+		.def	= "0",
+		.help	= "Tag this job's write commands with the requested write stream (Default: 0)",
+		.category = FIO_OPT_C_ENGINE,
+		.group	= FIO_OPT_G_IOURING,
+	},
 	{
 		.name	= "write_mode",
 		.lname	= "Additional Write commands support (Write Uncorrectable, Write Zeores)",
@@ -434,8 +445,11 @@ static int fio_ioring_prep(struct thread_data *td, struct io_u *io_u)
 		sqe->rw_flags = 0;
 		if (o->nowait)
 			sqe->rw_flags |= RWF_NOWAIT;
-		if (td->o.oatomic && io_u->ddir == DDIR_WRITE)
-			sqe->rw_flags |= RWF_ATOMIC;
+		if (io_u->ddir == DDIR_WRITE) {
+			if (td->o.oatomic)
+				sqe->rw_flags |= RWF_ATOMIC;
+			sqe->write_stream = o->write_stream;
+		}
 
 		/*
 		 * Since io_uring can have a submission context (sqthread_poll)
diff --git a/os/linux/io_uring.h b/os/linux/io_uring.h
index b3876381..8fa3d080 100644
--- a/os/linux/io_uring.h
+++ b/os/linux/io_uring.h
@@ -64,6 +64,10 @@ struct io_uring_sqe {
 	union {
 		__s32	splice_fd_in;
 		__u32	file_index;
+		struct {
+			__u8   write_stream;
+			__u8   __pad4[3];
+		};
 	};
 	union {
 		struct {
-- 
2.43.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] engine/io_uring: add write stream support
  2024-12-11 18:44 [PATCH] engine/io_uring: add write stream support Keith Busch
@ 2024-12-11 19:10 ` fiotestbot
  2024-12-11 19:11 ` Jens Axboe
  2024-12-11 19:43 ` Vincent Fu
  2 siblings, 0 replies; 4+ messages in thread
From: fiotestbot @ 2024-12-11 19:10 UTC (permalink / raw)
  To: fio

[-- Attachment #1: Type: text/plain, Size: 144 bytes --]


The result of fio's continuous integration tests was: success

For more details see https://github.com/fiotestbot/fio/actions/runs/12282914835

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] engine/io_uring: add write stream support
  2024-12-11 18:44 [PATCH] engine/io_uring: add write stream support Keith Busch
  2024-12-11 19:10 ` fiotestbot
@ 2024-12-11 19:11 ` Jens Axboe
  2024-12-11 19:43 ` Vincent Fu
  2 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2024-12-11 19:11 UTC (permalink / raw)
  To: Keith Busch, fio, vincent.fu; +Cc: Keith Busch

On 12/11/24 11:44 AM, Keith Busch wrote:
> From: Keith Busch <kbusch@kernel.org>
> 
> Let a user specify a write stream specific to each job. You can check
> the block device's max_write_streams sysfs queue attribute for the valid
> range of stream values.
> 
> Signed-off-by: Keith Busch <kbusch@kernel.org>
> ---
> This depends on the kernel side supporting this feature. The latest is
> here, which I *think* appears to have stablized on the API.
> 
>   https://lore.kernel.org/io-uring/20241210194722.1905732-1-kbusch@meta.com/T/#u

Looks fine to me, but let's hold off on the fio side until the kernel
changes are at least staged for a kernel.

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] engine/io_uring: add write stream support
  2024-12-11 18:44 [PATCH] engine/io_uring: add write stream support Keith Busch
  2024-12-11 19:10 ` fiotestbot
  2024-12-11 19:11 ` Jens Axboe
@ 2024-12-11 19:43 ` Vincent Fu
  2 siblings, 0 replies; 4+ messages in thread
From: Vincent Fu @ 2024-12-11 19:43 UTC (permalink / raw)
  To: Keith Busch, fio, vincent.fu, axboe; +Cc: Keith Busch

On 12/11/24 13:44, Keith Busch wrote:
> From: Keith Busch <kbusch@kernel.org>
> 
> Let a user specify a write stream specific to each job. You can check
> the block device's max_write_streams sysfs queue attribute for the valid
> range of stream values.
> 
> Signed-off-by: Keith Busch <kbusch@kernel.org>
> ---
> This depends on the kernel side supporting this feature. The latest is
> here, which I *think* appears to have stablized on the API.
> 
>    https://lore.kernel.org/io-uring/20241210194722.1905732-1-kbusch@meta.com/T/#u

[sending this again because I forgot to reply all]

Please add documentation for tihs option. Note that the stream_id option 
already exists for the sg ioengine. Consider using this pre-existing 
name to limit the growth of fio's already voluminous documentation.

Vincent




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-12-11 19:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-11 18:44 [PATCH] engine/io_uring: add write stream support Keith Busch
2024-12-11 19:10 ` fiotestbot
2024-12-11 19:11 ` Jens Axboe
2024-12-11 19:43 ` Vincent Fu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox