提交 2fe4bba1 编写于 作者: K Kevin Wolf

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: NKevin Wolf <kwolf@redhat.com>
Reviewed-by: NEric Blake <eblake@redhat.com>
上级 ad53ea42
......@@ -202,6 +202,8 @@ static void coroutine_fn commit_run(void *opaque)
if (copy && s->common.speed) {
delay_ns = ratelimit_calculate_delay(&s->limit, n);
} else {
delay_ns = 0;
}
}
......
......@@ -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;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册