[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 07/25] block/block-copy: add ratelimit to block-copy

From: Max Reitz
Subject: Re: [PATCH v3 07/25] block/block-copy: add ratelimit to block-copy
Date: Tue, 12 Jan 2021 11:48:01 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0

On 26.10.20 18:17, Vladimir Sementsov-Ogievskiy wrote:
We are going to directly use one async block-copy operation for backup
job, so we need rate limiter.

We want to maintain current backup behavior: only background copying is
limited and copy-before-write operations only participate in limit
calculation. Therefore we need one rate limiter for block-copy state
and boolean flag for block-copy call state for actual limitation.

Note, that we can't just calculate each chunk in limiter after
successful copying: it will not save us from starting a lot of async
sub-requests which will exceed limit too much. Instead let's use the
following scheme on sub-request creation:
1. If at the moment limit is not exceeded, create the request and
account it immediately.
2. If at the moment limit is already exceeded, drop create sub-request
and handle limit instead (by sleep).
With this approach we'll never exceed the limit more than by one
sub-request (which pretty much matches current backup behavior).

Note also, that if there is in-flight block-copy async call,
block_copy_kick() should be used after set-speed to apply new setup
faster. For that block_copy_kick() published in this patch.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
  include/block/block-copy.h |  5 ++++-
  block/backup-top.c         |  2 +-
  block/backup.c             |  2 +-
  block/block-copy.c         | 46 +++++++++++++++++++++++++++++++++++++-
  4 files changed, 51 insertions(+), 4 deletions(-)

Reviewed-by: Max Reitz <mreitz@redhat.com>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]