From b1552b6e655dba1b1d4957c04a19361654ab38ad Mon Sep 17 00:00:00 2001 From: John Garry Date: Mon, 16 Sep 2024 16:53:43 +0000 Subject: [PATCH] io_uring: Support RWF_ATOMIC Set RWF_ATOMIC for writes and oatomic==1. Signed-off-by: John Garry Link: https://lore.kernel.org/r/20240916165347.2226763-6-john.g.garry@oracle.com Signed-off-by: Jens Axboe --- engines/io_uring.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/engines/io_uring.c b/engines/io_uring.c index 1d4a6118..96a042a8 100644 --- a/engines/io_uring.c +++ b/engines/io_uring.c @@ -392,6 +392,8 @@ 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; /* * Since io_uring can have a submission context (sqthread_poll) @@ -1582,7 +1584,8 @@ static struct ioengine_ops ioengine_uring = { .name = "io_uring", .version = FIO_IOOPS_VERSION, .flags = FIO_ASYNCIO_SYNC_TRIM | FIO_NO_OFFLOAD | - FIO_ASYNCIO_SETS_ISSUE_TIME, + FIO_ASYNCIO_SETS_ISSUE_TIME | + FIO_ATOMICWRITES, .init = fio_ioring_init, .post_init = fio_ioring_post_init, .io_u_init = fio_ioring_io_u_init, -- 2.25.1