From 55b0e37323e7beb5a694eb309ab109497e8cf242 Mon Sep 17 00:00:00 2001 From: Minwoo Im Date: Sun, 23 Jun 2024 00:30:03 +0900 Subject: [PATCH] io_u: Support fsync for --rw=trimwrite Even if ddir is determined in get_rw_ddir(), ddir might be updated in set_rw_ddir(). if td represents trimwrite, it will be updated to either DDIR_TRIM or DDIR_WRITE even ddir already represents for DDIR_SYNC. To support DDIR_SYNC(fsync) for trimwrite, this patch checks ddir_sync() in case of trimwrite not to update the pre-determined ddir. Signed-off-by: Minwoo Im --- io_u.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/io_u.c b/io_u.c index f8ce8618cb..f81086b658 100644 --- a/io_u.c +++ b/io_u.c @@ -815,7 +815,7 @@ static void set_rw_ddir(struct thread_data *td, struct io_u *io_u) if (td->o.zone_mode == ZONE_MODE_ZBD) ddir = zbd_adjust_ddir(td, io_u, ddir); - if (td_trimwrite(td)) { + if (td_trimwrite(td) && !ddir_sync(ddir)) { struct fio_file *f = io_u->file; if (f->last_start[DDIR_WRITE] == f->last_start[DDIR_TRIM]) ddir = DDIR_TRIM;