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

Damien Le Moal <[email protected]> Fri, 27 Feb 2026 14:55:38 +0900
Newsgroups org.kernel.vger.fio
Message-ID <[email protected]>
Flag the posixaio IO engine with FIO_ASYNCIO_SYNC_SYNCFS to indicate
that it supports the syncfs operation, synchronously. Also change
fio_posixaio_queue() to execute aio_fsync() only for sync operations
that are not a syncfs, in which case, we directly call do_io_u_sync().

Signed-off-by: Damien Le Moal <[email protected]>
---
 engines/posixaio.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/engines/posixaio.c b/engines/posixaio.c
index 2d0ac9fcc369..828e535157a0 100644
--- a/engines/posixaio.c
+++ b/engines/posixaio.c
@@ -142,7 +142,10 @@ static enum fio_q_status fio_posixaio_queue(struct thread_data *td,
 		return FIO_Q_COMPLETED;
 	} else {
 #ifdef CONFIG_POSIXAIO_FSYNC
-		ret = aio_fsync(O_SYNC, aiocb);
+		if (io_u->ddir != DDIR_SYNCFS)
+			ret = aio_fsync(O_SYNC, aiocb);
+		else
+			ret = 0;
 #else
 		if (pd->queued)
 			return FIO_Q_BUSY;
@@ -196,7 +199,8 @@ static int fio_posixaio_init(struct thread_data *td)
 static struct ioengine_ops ioengine = {
 	.name		= "posixaio",
 	.version	= FIO_IOOPS_VERSION,
-	.flags		= FIO_ASYNCIO_SYNC_TRIM,
+	.flags		= FIO_ASYNCIO_SYNC_TRIM |
+				FIO_ASYNCIO_SYNC_SYNCFS,
 	.init		= fio_posixaio_init,
 	.prep		= fio_posixaio_prep,
 	.queue		= fio_posixaio_queue,
-- 
2.53.0