qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
	qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, lcapitulino@redhat.com, armbru@redhat.com,
	mreitz@redhat.com, kwolf@redhat.com, jcody@redhat.com,
	den@virtuozzo.com
Subject: Re: [Qemu-devel] [PATCH] mirror: add target-zeroed flag
Date: Fri, 3 Jun 2016 09:06:34 -0600	[thread overview]
Message-ID: <57519CFA.4000400@redhat.com> (raw)
In-Reply-To: <1464962711-617992-1-git-send-email-vsementsov@virtuozzo.com>

[-- Attachment #1: Type: text/plain, Size: 3935 bytes --]

On 06/03/2016 08:05 AM, Vladimir Sementsov-Ogievskiy wrote:
> Add target-zeroed flag to allow user specify that target is already
> zeroed. With this flag set zeroes which was in source before mirror
> start will not be copyed.

With this flag set, any runs of zeroes in the source before the mirror
starts will not be copied.

> 
> Without this libvirt migration of empty disk takes too long time.
> 
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
> 
> I've tested it with
> time virsh migrate --live test qemu+ssh://other_node/system --copy-storage-all

Presumably with a libvirt patch to turn on the optional flag.

I'm not sure I like this patch.  Libvirt uses NBD to implement
--copy-storage-all, I think we're better off improving NBD to
automatically handle sparse writes, than we are to add a one-off hack
that requires libvirt to change.  That is, once NBD is smarter, the copy
will be faster without needing a tweak.  And we ARE working on making
NBD smarter (one of my goals for the 2.7 release is to get all the
sparse file additions to NBD implemented)

That said, I'll still review it.

> 
> Without 'target-zeroed' libvirt migration of vm with empty qcow2 disk of
> 400Mb to another node takes for me more than 5 minutes. Migration of 5Gb
> disk was not finished in 28 minutes.
> 
> With new flag on, migration of 16Tb empty disk takes about a minute.
> 
>  block/mirror.c            | 16 +++++++++++-----
>  blockdev.c                |  9 ++++++++-
>  hmp.c                     |  2 +-
>  include/block/block_int.h |  2 +-
>  qapi/block-core.json      |  5 ++++-
>  qmp-commands.hx           |  4 +++-
>  6 files changed, 28 insertions(+), 10 deletions(-)
> 

> +++ b/hmp.c
> @@ -1097,7 +1097,7 @@ void hmp_drive_mirror(Monitor *mon, const QDict *qdict)
>                       false, NULL, false, NULL,
>                       full ? MIRROR_SYNC_MODE_FULL : MIRROR_SYNC_MODE_TOP,
>                       true, mode, false, 0, false, 0, false, 0,
> -                     false, 0, false, 0, false, true, &err);
> +                     false, 0, false, 0, false, true, false, false, &err);

I'd like for my qapi 'box' patches to land, so that this can be simpler.

https://lists.gnu.org/archive/html/qemu-devel/2016-05/msg03569.html

> +++ b/qapi/block-core.json
> @@ -1154,6 +1154,9 @@
>  #         written. Both will result in identical contents.
>  #         Default is true. (Since 2.4)
>  #
> +# @target-zeroed: #optional Whether target is already zeroed, so most of zeroes
> +#                 should not be transferred. (Since 2.7)

Grammar suggestion:

#optional True if target already reads as all zeroes, so that holes in
the source need not be transferred. (Since 2.7)

> +++ b/qmp-commands.hx
> @@ -1632,7 +1632,7 @@ EQMP
>          .args_type  = "sync:s,device:B,target:s,speed:i?,mode:s?,format:s?,"
>                        "node-name:s?,replaces:s?,"
>                        "on-source-error:s?,on-target-error:s?,"
> -                      "unmap:b?,"
> +                      "unmap:b?,target-zeroed:b?"
>                        "granularity:i?,buf-size:i?",

I'm trying to get rid of .args_type (or rather, Marc-Andre's qapi
patches, that are stalled on my qapi patches, do the job); but for now
this part is correct.

>          .mhandler.cmd_new = qmp_marshal_drive_mirror,
>      },
> @@ -1674,6 +1674,8 @@ Arguments:
>    (BlockdevOnError, default 'report')
>  - "unmap": whether the target sectors should be discarded where source has only
>    zeroes. (json-bool, optional, default true)
> +- "target-zeroed": whether target is already zeroed, so most of zeroes should
> +  not be transferred. (json-bool, optional, default false)

Similar wording as above.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2016-06-03 15:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-03 14:05 [Qemu-devel] [PATCH] mirror: add target-zeroed flag Vladimir Sementsov-Ogievskiy
2016-06-03 15:06 ` Eric Blake [this message]
2016-06-03 15:45   ` Denis V. Lunev
2016-06-07 16:30     ` Vladimir Sementsov-Ogievskiy
2016-06-10 16:59       ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2016-06-11 11:57         ` Denis V. Lunev

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=57519CFA.4000400@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@redhat.com \
    --cc=den@virtuozzo.com \
    --cc=jcody@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --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).