[PATCH v4 7/8] engines: ftruncate: add support for DDIR_SYNCFS

Damien Le Moal <[email protected]> Fri, 27 Feb 2026 17:07:10 +0900
Newsgroups org.kernel.vger.fio
Message-ID <[email protected]>
Flag the ftruncate IO engine with FIO_SYNCFS to indicate that it
supports the syncfs operation. Also change fio_ftruncate_queue() to use
ddir_sync() to include all variants of the sync operation for driving
the call to do_io_u_sync(), instead of testing for DDIR_SYNC only as
that leads to ignoring other sync variants.

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

diff --git a/engines/ftruncate.c b/engines/ftruncate.c
index 70211e0705f7..c1dcba7dc46f 100644
--- a/engines/ftruncate.c
+++ b/engines/ftruncate.c
@@ -21,7 +21,7 @@ static enum fio_q_status fio_ftruncate_queue(struct thread_data *td,
 
 	if (io_u->ddir == DDIR_WRITE)
 		ret = ftruncate(f->fd, io_u->offset);
-	else if (io_u->ddir == DDIR_SYNC)
+	else if (ddir_sync(io_u->ddir))
 		ret = do_io_u_sync(td, io_u);
 	else
 		io_u->error = EINVAL;
@@ -39,7 +39,7 @@ static struct ioengine_ops ioengine = {
 	.open_file	= generic_open_file,
 	.close_file	= generic_close_file,
 	.get_file_size	= generic_get_file_size,
-	.flags		= FIO_SYNCIO | FIO_FAKEIO
+	.flags		= FIO_SYNCIO | FIO_FAKEIO | FIO_SYNCFS,
 };
 
 static void fio_init fio_syncio_register(void)
-- 
2.53.0