qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: Max Reitz <mreitz@redhat.com>,
	"qemu-block@nongnu.org" <qemu-block@nongnu.org>
Cc: Kevin Wolf <kwolf@redhat.com>, John Snow <jsnow@redhat.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] mirror: Only mirror granularity-aligned chunks
Date: Mon, 5 Aug 2019 13:00:00 +0000	[thread overview]
Message-ID: <f3b36f80-589f-039d-233b-1a54f2cfcefc@virtuozzo.com> (raw)
In-Reply-To: <20190805114923.23701-1-mreitz@redhat.com>

05.08.2019 14:49, Max Reitz wrote:
> In write-blocking mode, all writes to the top node directly go to the
> target.  We must only mirror chunks of data that are aligned to the
> job's granularity, because that is how the dirty bitmap works.
> Therefore, the request alignment for writes must be the job's
> granularity (in write-blocking mode).
> 
> Unfortunately, this forces all reads and writes to have the same
> granularity (we only need this alignment for writes to the target, not
> the source), but that is something to be fixed another time.
> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
> This is an alternative to Vladimir's "util/hbitmap: fix unaligned reset"
> patch.  I don't mind much either way, both of pros and cons.  Comparing
> this patch to Vladimir's:
> 
> + Makes copy-mode=write-blocking really work (unless I'm mistaken)
> - Lowers performance with copy-mode=write-blocking unnecessarily
> ---
>   block/mirror.c | 12 ++++++++++++
>   1 file changed, 12 insertions(+)
> 
> diff --git a/block/mirror.c b/block/mirror.c
> index 8cb75fb409..3f9c5a178a 100644
> --- a/block/mirror.c
> +++ b/block/mirror.c
> @@ -1481,6 +1481,15 @@ static void bdrv_mirror_top_child_perm(BlockDriverState *bs, BdrvChild *c,
>       *nshared = BLK_PERM_ALL;
>   }
>   
> +static void bdrv_mirror_top_refresh_limits(BlockDriverState *bs, Error **errp)
> +{
> +    MirrorBDSOpaque *s = bs->opaque;
> +
> +    if (s && s->job && s->job->copy_mode == MIRROR_COPY_MODE_WRITE_BLOCKING) {
> +        bs->bl.request_alignment = s->job->granularity;
> +    }
> +}
> +
>   /* Dummy node that provides consistent read to its users without requiring it
>    * from its backing file and that allows writes on the backing file chain. */
>   static BlockDriver bdrv_mirror_top = {
> @@ -1493,6 +1502,7 @@ static BlockDriver bdrv_mirror_top = {
>       .bdrv_co_block_status       = bdrv_co_block_status_from_backing,
>       .bdrv_refresh_filename      = bdrv_mirror_top_refresh_filename,
>       .bdrv_child_perm            = bdrv_mirror_top_child_perm,
> +    .bdrv_refresh_limits        = bdrv_mirror_top_refresh_limits,
>   };
>   
>   static BlockJob *mirror_start_job(
> @@ -1678,6 +1688,8 @@ static BlockJob *mirror_start_job(
>   
>       QTAILQ_INIT(&s->ops_in_flight);
>   
> +    bdrv_refresh_limits(mirror_top_bs, &error_abort);
> +
>       trace_mirror_start(bs, s, opaque);
>       job_start(&s->common.job);
>   
> 

Am I right that the fact that no guest request will skip this limit is guaranteed by
aio_context_acquire/release around blockdev_mirror_common?

Not sure how much it lowers performance, but it should work..
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>

-- 
Best regards,
Vladimir

  parent reply	other threads:[~2019-08-05 13:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-05 11:49 [Qemu-devel] [PATCH] mirror: Only mirror granularity-aligned chunks Max Reitz
2019-08-05 11:52 ` Max Reitz
2019-08-05 13:00 ` Vladimir Sementsov-Ogievskiy [this message]
2019-08-05 13:49   ` Max Reitz

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=f3b36f80-589f-039d-233b-1a54f2cfcefc@virtuozzo.com \
    --to=vsementsov@virtuozzo.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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).