From: Jens Axboe Date: Thu, 7 Dec 2017 16:06:04 +0000 (-0700) Subject: rate: ensure IO issue restarts right after sleep X-Git-Tag: fio-3.3~17 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=1aa39b0ce447f228460e6d0af601fee88fd5f4b4;ds=sidebyside rate: ensure IO issue restarts right after sleep If we have rate_ignore_thinktime set, we account the number of bytes we would have done in the period of the sleep. However, we need to subtract one block, otherwise we end up doing a rated sleep right after the thinktime sleep. Fixes: 1a9bf814 ("Add option to ignore thinktime for rated IO") Signed-off-by: Jens Axboe --- diff --git a/backend.c b/backend.c index 69f03dcf..5304ddc0 100644 --- a/backend.c +++ b/backend.c @@ -894,10 +894,13 @@ static void handle_thinktime(struct thread_data *td, enum fio_ddir ddir) /* * If we're ignoring thinktime for the rate, add the number of bytes - * we would have done while sleeping. + * we would have done while sleeping, minus one block to ensure we + * start issuing immediately after the sleep. */ - if (total && td->rate_bps[ddir] && td->o.rate_ign_think) + if (total && td->rate_bps[ddir] && td->o.rate_ign_think) { td->rate_io_issue_bytes[ddir] += (td->rate_bps[ddir] * 1000000) / total; + td->rate_io_issue_bytes[ddir] -= td->o.min_bs[ddir]; + } } /*