From: Emanuele Giuseppe Esposito <eesposit@redhat.com>
To: qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
Emanuele Giuseppe Esposito <eesposit@redhat.com>,
Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
qemu-devel@nongnu.org, Max Reitz <mreitz@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>, John Snow <jsnow@redhat.com>
Subject: [PATCH v2 3/5] blockjob: let ratelimit handle a speed of 0
Date: Tue, 18 May 2021 11:40:56 +0200 [thread overview]
Message-ID: <20210518094058.25952-4-eesposit@redhat.com> (raw)
In-Reply-To: <20210518094058.25952-1-eesposit@redhat.com>
From: Paolo Bonzini <pbonzini@redhat.com>
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>
---
blockjob.c | 13 +++----------
1 file 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;
--
2.30.2
next prev parent reply other threads:[~2021-05-18 9:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-18 9:40 [PATCH v2 0/5] block-copy: make helper APIs thread safe Emanuele Giuseppe Esposito
2021-05-18 9:40 ` [PATCH v2 1/5] ratelimit: treat zero speed as unlimited Emanuele Giuseppe Esposito
2021-05-18 9:40 ` [PATCH v2 2/5] block-copy: let ratelimit handle a speed of 0 Emanuele Giuseppe Esposito
2021-05-18 9:40 ` Emanuele Giuseppe Esposito [this message]
2021-05-18 9:40 ` [PATCH v2 4/5] progressmeter: protect with a mutex Emanuele Giuseppe Esposito
2021-05-18 10:00 ` Vladimir Sementsov-Ogievskiy
2021-05-18 10:14 ` Emanuele Giuseppe Esposito
2021-05-31 14:24 ` Stefan Hajnoczi
2021-05-18 9:40 ` [PATCH v2 5/5] co-shared-resource: " Emanuele Giuseppe Esposito
2021-05-18 14:50 ` Vladimir Sementsov-Ogievskiy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210518094058.25952-4-eesposit@redhat.com \
--to=eesposit@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=vsementsov@virtuozzo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).