From 2fe4bba19b754b3872a58e53fa49c2b93b398301 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Thu, 18 Jan 2018 21:23:52 +0100 Subject: commit/stream: Reset delay_ns Streaming and the commit block job only want to apply throttling when they actually copied data instead of skipping it, so they made the calculation of delay_ns conditional. However, delay_ns isn't reset when skipping some sectors, so instead of not waiting, the old delay is applied again. Properly reset delay_ns where needed. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- block/stream.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'block/stream.c') diff --git a/block/stream.c b/block/stream.c index f3b53f4..1a85708 100644 --- a/block/stream.c +++ b/block/stream.c @@ -188,6 +188,8 @@ static void coroutine_fn stream_run(void *opaque) s->common.offset += n; if (copy && s->common.speed) { delay_ns = ratelimit_calculate_delay(&s->limit, n); + } else { + delay_ns = 0; } } -- cgit v1.1