On 14/12/2017 01:59, John Snow wrote:
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
> block/backup.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/block/backup.c b/block/backup.c
> index d71b25c017..a5ede5f643 100644
> --- a/block/backup.c
> +++ b/block/backup.c
> @@ -334,6 +334,8 @@ static void backup_complete(BlockJob *job, void *opaque)
>
> static bool coroutine_fn yield_and_check(BackupBlockJob *job)
> {
> + uint64_t delay_ns = 0;
> +
> if (block_job_is_cancelled(&job->common)) {
> return true;
> }
> @@ -342,14 +344,13 @@ static bool coroutine_fn yield_and_check(BackupBlockJob *job)
> * (without, VM does not reboot)
> */
> if (job->common.speed) {
> - uint64_t delay_ns = ratelimit_calculate_delay(&job->limit,
> - job->bytes_read);
> + delay_ns = ratelimit_calculate_delay(&job->limit,
> + job->bytes_read);
> job->bytes_read = 0;
> - block_job_sleep_ns(&job->common, delay_ns);
> - } else {
> - block_job_sleep_ns(&job->common, 0);
> }
>
> + block_job_throttle(&job->common, delay_ns);
> +
> if (block_job_is_cancelled(&job->common)) {
> return true;
> }
>
This one is. :)
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>