[PATCH v3 4/8] engines: io_uring: add support for DDIR_SYNCFS

Damien Le Moal <[email protected]> Fri, 27 Feb 2026 14:55:34 +0900
Newsgroups org.kernel.vger.fio
Message-ID <[email protected]>
Flag the io_uring engine with the FIO_ASYNCIO_SYNC_SYNCFS flag to
indicate that the syncfs operation is supported, synchronously.
Modify fio_ioring_queue() to call do_io_u_sync() for an io_u that has
the DDIR_SYNCFS data direction.

Signed-off-by: Damien Le Moal <[email protected]>
---
 engines/io_uring.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/engines/io_uring.c b/engines/io_uring.c
index 0ea3aba12e2c..d4dff3b8f275 100644
--- a/engines/io_uring.c
+++ b/engines/io_uring.c
@@ -890,12 +890,19 @@ static enum fio_q_status fio_ioring_queue(struct thread_data *td,
 	if (ld->queued == td->o.iodepth)
 		return FIO_Q_BUSY;
 
-	/* if async trim has been tried and failed, punt to sync */
-	if (io_u->ddir == DDIR_TRIM && ld->async_trim_fail) {
+	/*
+	 * If this is a syncfs request, or if async trim has been tried and
+	 * failed, punt to sync.
+	 * */
+	if (io_u->ddir == DDIR_SYNCFS ||
+	    (io_u->ddir == DDIR_TRIM && ld->async_trim_fail)) {
 		if (ld->queued)
 			return FIO_Q_BUSY;
 
-		do_io_u_trim(td, io_u);
+		if (io_u->ddir == DDIR_TRIM)
+			do_io_u_trim(td, io_u);
+		else
+			do_io_u_sync(td, io_u);
 
 		io_u_mark_submit(td, 1);
 		io_u_mark_complete(td, 1);
@@ -2013,7 +2020,8 @@ static struct ioengine_ops ioengine_uring_cmd = {
 	.version		= FIO_IOOPS_VERSION,
 	.flags			= FIO_NO_OFFLOAD | FIO_MEMALIGN | FIO_RAWIO |
 					FIO_ASYNCIO_SETS_ISSUE_TIME |
-					FIO_MULTI_RANGE_TRIM,
+					FIO_MULTI_RANGE_TRIM |
+					FIO_ASYNCIO_SYNC_SYNCFS,
 	.init			= fio_ioring_init,
 	.post_init		= fio_ioring_cmd_post_init,
 	.io_u_init		= fio_ioring_io_u_init,
-- 
2.53.0