Fix skewed latencies for rate IOPS
authorSEOKYOUNG KO <seokyoung.ko@samsung.com>
Thu, 7 Mar 2013 11:34:31 +0000 (12:34 +0100)
committerJens Axboe <axboe@kernel.dk>
Thu, 7 Mar 2013 11:34:31 +0000 (12:34 +0100)
- when -rate_iops is specified, FIO periodically calls usleep() to limit IOPS

- Before usleep(), FIO always wait until the completion of all pending I/O

- For all I/O completions, FIO shows erroneous behavior of logging their
  latency, with that of the longest latency IO sample.

- w/ QD=8/ mixed R:W=33:66, up to 7 samples may get false latency log when
  waiting all I/O completions => False report of latency distribution

Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_u.c

diff --git a/io_u.c b/io_u.c
index e474b48f9ca0c4ab5a26f49363f90e2a4bacc1d2..7941a6d739483edfc5e3b3e81403716133eee97a 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -531,10 +531,10 @@ static enum fio_ddir rate_ddir(struct thread_data *td, enum fio_ddir ddir)
         * io's that have been actually submitted to an async engine,
         * and cur_depth is meaningless for sync engines.
         */
-       if (td->io_u_in_flight) {
+       while (td->io_u_in_flight) {
                int fio_unused ret;
 
-               ret = io_u_queued_complete(td, td->io_u_in_flight, NULL);
+               ret = io_u_queued_complete(td, 1, NULL);
        }
 
        fio_gettime(&t, NULL);