From e11046bfb64bb82ac928013fe41cd022f6d529db Mon Sep 17 00:00:00 2001 From: Minwoo Im Date: Wed, 10 Jul 2024 07:48:56 +0900 Subject: [PATCH] td: Replace last_was_sync with last_ddir_issued `last_was_sync` has represented that the last command had DDIR_SYNC. This can be replaced with `ddir_sync(last_ddir_issued)` and it's much more flexible to represent the last issued command's data direction. Signed-off-by: Minwoo Im --- fio.h | 5 +++-- ioengines.c | 4 ++-- libfio.c | 1 - 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fio.h b/fio.h index c5b4df21..4bb6cfa7 100644 --- a/fio.h +++ b/fio.h @@ -258,8 +258,9 @@ struct thread_data { size_t orig_buffer_size; volatile int runstate; volatile bool terminate; - bool last_was_sync; + enum fio_ddir last_ddir_completed; + enum fio_ddir last_ddir_issued; int mmapfd; @@ -629,7 +630,7 @@ static inline bool multi_range_trim(struct thread_data *td, struct io_u *io_u) static inline bool should_fsync(struct thread_data *td) { - if (td->last_was_sync) + if (ddir_sync(td->last_ddir_issued)) return false; if (td_write(td) || td->o.override_sync) return true; diff --git a/ioengines.c b/ioengines.c index 6b81dc77..dcd4164d 100644 --- a/ioengines.c +++ b/ioengines.c @@ -437,7 +437,7 @@ enum fio_q_status td_io_queue(struct thread_data *td, struct io_u *io_u) td->ts.total_io_u[io_u->ddir]++; } - td->last_was_sync = ddir_sync(io_u->ddir); + td->last_ddir_issued = ddir; } else if (ret == FIO_Q_QUEUED) { td->io_u_queued++; @@ -448,7 +448,7 @@ enum fio_q_status td_io_queue(struct thread_data *td, struct io_u *io_u) if (td->io_u_queued >= td->o.iodepth_batch) td_io_commit(td); - td->last_was_sync = ddir_sync(io_u->ddir); + td->last_ddir_issued = ddir; } if (!td_ioengine_flagged(td, FIO_SYNCIO) && diff --git a/libfio.c b/libfio.c index d0c6bf8f..2596ae5a 100644 --- a/libfio.c +++ b/libfio.c @@ -101,7 +101,6 @@ static void reset_io_counters(struct thread_data *td, int all) td->zone_bytes = 0; - td->last_was_sync = false; td->rwmix_issues = 0; /* -- 2.25.1