From 46960d0d3a4b36f7fb2ee1f356563aa367a27082 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 5 Jun 2018 13:21:36 -0600 Subject: [PATCH] Cleanup should_check_rate() Don't need to check direction for __should_check_rate(), so clean up the logic. Signed-off-by: Jens Axboe --- backend.c | 8 ++------ fio.h | 13 ++++--------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/backend.c b/backend.c index 180348f8..e3ff777b 100644 --- a/backend.c +++ b/backend.c @@ -432,9 +432,7 @@ static int wait_for_completions(struct thread_data *td, struct timespec *time) if ((full && !min_evts) || !td->o.iodepth_batch_complete_min) min_evts = 1; - if (time && (__should_check_rate(td, DDIR_READ) || - __should_check_rate(td, DDIR_WRITE) || - __should_check_rate(td, DDIR_TRIM))) + if (time && __should_check_rate(td)) fio_gettime(time, NULL); do { @@ -489,9 +487,7 @@ int io_queue_event(struct thread_data *td, struct io_u *io_u, int *ret, requeue_io_u(td, &io_u); } else { sync_done: - if (comp_time && (__should_check_rate(td, DDIR_READ) || - __should_check_rate(td, DDIR_WRITE) || - __should_check_rate(td, DDIR_TRIM))) + if (comp_time && __should_check_rate(td)) fio_gettime(comp_time, NULL); *ret = io_u_sync_complete(td, io_u); diff --git a/fio.h b/fio.h index 6c897fc6..9f3140a9 100644 --- a/fio.h +++ b/fio.h @@ -721,22 +721,17 @@ static inline bool option_check_rate(struct thread_data *td, enum fio_ddir ddir) return false; } -static inline bool __should_check_rate(struct thread_data *td, - enum fio_ddir ddir) +static inline bool __should_check_rate(struct thread_data *td) { return (td->flags & TD_F_CHECK_RATE) != 0; } static inline bool should_check_rate(struct thread_data *td) { - if (__should_check_rate(td, DDIR_READ) && td->bytes_done[DDIR_READ]) - return true; - if (__should_check_rate(td, DDIR_WRITE) && td->bytes_done[DDIR_WRITE]) - return true; - if (__should_check_rate(td, DDIR_TRIM) && td->bytes_done[DDIR_TRIM]) - return true; + if (!__should_check_rate(td)) + return false; - return false; + return ddir_rw_sum(td->bytes_done) != 0; } static inline unsigned int td_max_bs(struct thread_data *td) -- 2.25.1