From: SEOKYOUNG KO Date: Thu, 7 Mar 2013 11:34:31 +0000 (+0100) Subject: Fix skewed latencies for rate IOPS X-Git-Tag: fio-2.0.15~40 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=c3a1b740381cb19e467c8588562bac4d6cbbb199 Fix skewed latencies for rate IOPS - 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 --- diff --git a/io_u.c b/io_u.c index e474b48f..7941a6d7 100644 --- 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);