diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2021-06-14 10:11:28 +0200 |
---|---|---|
committer | Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | 2021-06-25 14:24:24 +0300 |
commit | c02b83ed1ff62211f4c44855e0ca1656d5811688 (patch) | |
tree | 313f9bbfb549da3a86b03125442f80784247d7d0 | |
parent | ca657c99e6b41fa765443fc93df5c4adf468e369 (diff) | |
download | qemu-c02b83ed1ff62211f4c44855e0ca1656d5811688.zip |
blockjob: let ratelimit handle a speed of 0
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Message-Id: <20210614081130.22134-4-eesposit@redhat.com>
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
-rw-r--r-- | blockjob.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/blockjob.c b/blockjob.c index dc1d9e0e46..22e5bb9b1f 100644 --- a/blockjob.c +++ b/blockjob.c @@ -300,10 +300,6 @@ bool block_job_set_speed(BlockJob *job, int64_t speed, Error **errp) int64_t block_job_ratelimit_get_delay(BlockJob *job, uint64_t n) { - if (!job->speed) { - return 0; - } - return ratelimit_calculate_delay(&job->limit, n); } @@ -472,12 +468,9 @@ void *block_job_create(const char *job_id, const BlockJobDriver *driver, blk_set_disable_request_queuing(blk, true); blk_set_allow_aio_context_change(blk, true); - /* Only set speed when necessary to avoid NotSupported error */ - if (speed != 0) { - if (!block_job_set_speed(job, speed, errp)) { - job_early_fail(&job->job); - return NULL; - } + if (!block_job_set_speed(job, speed, errp)) { + job_early_fail(&job->job); + return NULL; } return job; |