From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: Emanuele Giuseppe Esposito <eesposit@redhat.com>, qemu-block@nongnu.org
Cc: John Snow <jsnow@redhat.com>, Kevin Wolf <kwolf@redhat.com>,
Max Reitz <mreitz@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
qemu-devel@nongnu.org
Subject: Re: [PATCH v3 2/5] block-copy: let ratelimit handle a speed of 0
Date: Sat, 19 Jun 2021 15:04:18 +0300 [thread overview]
Message-ID: <44481643-603c-df07-83d6-f0c33fd86e6d@virtuozzo.com> (raw)
In-Reply-To: <20210614081130.22134-3-eesposit@redhat.com>
14.06.2021 11:11, Emanuele Giuseppe Esposito wrote:
> 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>
> ---
> block/block-copy.c | 28 +++++++++++-----------------
> 1 file changed, 11 insertions(+), 17 deletions(-)
>
> diff --git a/block/block-copy.c b/block/block-copy.c
> index 5808cfe657..943e30b7e6 100644
> --- a/block/block-copy.c
> +++ b/block/block-copy.c
> @@ -114,7 +114,6 @@ typedef struct BlockCopyState {
>
> SharedResource *mem;
>
> - uint64_t speed;
> RateLimit rate_limit;
> } BlockCopyState;
>
> @@ -647,21 +646,19 @@ block_copy_dirty_clusters(BlockCopyCallState *call_state)
> task->copy_range = false;
> }
>
> - if (s->speed) {
> - if (!call_state->ignore_ratelimit) {
> - uint64_t ns = ratelimit_calculate_delay(&s->rate_limit, 0);
> - if (ns > 0) {
> - block_copy_task_end(task, -EAGAIN);
> - g_free(task);
> - qemu_co_sleep_ns_wakeable(&call_state->sleep,
> - QEMU_CLOCK_REALTIME, ns);
> - continue;
> - }
> + if (!call_state->ignore_ratelimit) {
> + uint64_t ns = ratelimit_calculate_delay(&s->rate_limit, 0);
> + if (ns > 0) {
> + block_copy_task_end(task, -EAGAIN);
> + g_free(task);
> + qemu_co_sleep_ns_wakeable(&call_state->sleep,
> + QEMU_CLOCK_REALTIME, ns);
Indentation broken. Can be fixed when applying, not worth resending
> + continue;
> }
> -
> - ratelimit_calculate_delay(&s->rate_limit, task->bytes);
> }
>
> + ratelimit_calculate_delay(&s->rate_limit, task->bytes);
> +
> trace_block_copy_process(s, task->offset);
>
> co_get_from_shres(s->mem, task->bytes);
> @@ -853,10 +850,7 @@ void block_copy_set_skip_unallocated(BlockCopyState *s, bool skip)
>
> void block_copy_set_speed(BlockCopyState *s, uint64_t speed)
> {
> - s->speed = speed;
> - if (speed > 0) {
> - ratelimit_set_speed(&s->rate_limit, speed, BLOCK_COPY_SLICE_TIME);
> - }
> + ratelimit_set_speed(&s->rate_limit, speed, BLOCK_COPY_SLICE_TIME);
>
> /*
> * Note: it's good to kick all call states from here, but it should be done
>
--
Best regards,
Vladimir
next prev parent reply other threads:[~2021-06-19 12:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-14 8:11 [PATCH v3 0/5] block-copy: make helper APIs thread safe Emanuele Giuseppe Esposito
2021-06-14 8:11 ` [PATCH v3 1/5] ratelimit: treat zero speed as unlimited Emanuele Giuseppe Esposito
2021-06-14 8:11 ` [PATCH v3 2/5] block-copy: let ratelimit handle a speed of 0 Emanuele Giuseppe Esposito
2021-06-19 12:04 ` Vladimir Sementsov-Ogievskiy [this message]
2021-06-14 8:11 ` [PATCH v3 3/5] blockjob: " Emanuele Giuseppe Esposito
2021-06-14 8:11 ` [PATCH v3 4/5] progressmeter: protect with a mutex Emanuele Giuseppe Esposito
2021-06-19 12:02 ` Vladimir Sementsov-Ogievskiy
2021-06-14 8:11 ` [PATCH v3 5/5] co-shared-resource: " Emanuele Giuseppe Esposito
2021-06-14 8:17 ` [PATCH v3 0/5] block-copy: make helper APIs thread safe Emanuele Giuseppe Esposito
2021-06-19 12:21 ` Vladimir Sementsov-Ogievskiy
2021-06-19 20:17 ` Vladimir Sementsov-Ogievskiy
2021-06-25 11:27 ` Vladimir Sementsov-Ogievskiy
-- strict thread matches above, loose matches on Subject: below --
2021-06-14 8:08 Emanuele Giuseppe Esposito
2021-06-14 8:08 ` [PATCH v3 2/5] block-copy: let ratelimit handle a speed of 0 Emanuele Giuseppe Esposito
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=44481643-603c-df07-83d6-f0c33fd86e6d@virtuozzo.com \
--to=vsementsov@virtuozzo.com \
--cc=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 \
/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).