workqueue: remove knowledge of td queue state
[fio.git] / io_u.c
diff --git a/io_u.c b/io_u.c
index d45a6f010a92f31b2f27f55777e61c17348dc5b5..9628d5e32c791e1a847013be81cad3488687a024 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -542,8 +542,10 @@ static inline enum fio_ddir get_rand_ddir(struct thread_data *td)
        return DDIR_WRITE;
 }
 
-void io_u_quiesce(struct thread_data *td)
+int io_u_quiesce(struct thread_data *td)
 {
+       int completed = 0;
+
        /*
         * We are going to sleep, ensure that we flush anything pending as
         * not to skew our latency numbers.
@@ -563,7 +565,11 @@ void io_u_quiesce(struct thread_data *td)
                int fio_unused ret;
 
                ret = io_u_queued_complete(td, 1);
+               if (ret > 0)
+                       completed += ret;
        }
+
+       return completed;
 }
 
 static enum fio_ddir rate_ddir(struct thread_data *td, enum fio_ddir ddir)
@@ -1553,7 +1559,7 @@ struct io_u *get_io_u(struct thread_data *td)
 out:
        assert(io_u->file);
        if (!td_io_prep(td, io_u)) {
-               if (!td->o.disable_slat)
+               if (!td->o.disable_lat)
                        fio_gettime(&io_u->start_time, NULL);
                if (do_scramble)
                        small_content_scramble(io_u);
@@ -1599,8 +1605,8 @@ void io_u_log_error(struct thread_data *td, struct io_u *io_u)
 
 static inline bool gtod_reduce(struct thread_data *td)
 {
-       return td->o.disable_clat && td->o.disable_lat && td->o.disable_slat
-               && td->o.disable_bw;
+       return (td->o.disable_clat && td->o.disable_slat && td->o.disable_bw)
+                       || td->o.gtod_reduce;
 }
 
 static void account_io_completion(struct thread_data *td, struct io_u *io_u,
@@ -1856,7 +1862,7 @@ int io_u_queued_complete(struct thread_data *td, int min_evts)
        for (ddir = DDIR_READ; ddir < DDIR_RWDIR_CNT; ddir++)
                td->bytes_done[ddir] += icd.bytes_done[ddir];
 
-       return 0;
+       return ret;
 }
 
 /*