All of lore.kernel.org
 help / color / mirror / Atom feed
From: wyang <w90p710@gmail.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: jcody@redhat.com, qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH] block/mirror: enable detect zeroes when driving mirror
Date: Wed, 23 Nov 2016 11:12:26 +0800	[thread overview]
Message-ID: <5835091A.5050107@gmail.com> (raw)
In-Reply-To: <20161122100915.GA5615@noname.redhat.com>

On 2016年11月22日 18:09, Kevin Wolf wrote:
> Am 22.11.2016 um 04:45 hat wyang geschrieben:
>> On 2016年11月21日 19:34, Kevin Wolf wrote:
>>> Am 21.11.2016 um 02:24 hat Yang Wei geschrieben:
>>>> In order to preserve sparse disk image, detect_zeroes
>>>> should also be enabled when bdrv_get_block_status_above()
>>>> returns BDRV_BLOCK_DATA
>>>>
>>>> Signed-off-by: Yang Wei <w90p710@gmail.com>
>>> Just preserving sparseness is exactly why bdrv_get_block_status_above()
>>> is checked, and this happens always.
>> I have a sparse qcow2 image(virtual size: 20G disk size: 12G),
>> # qemu-img info 20G.img
>> image: 20G.img
>> file format: qcow2
>> virtual size: 20G (21474836480 bytes)
>> disk size: 12G
>> cluster_size: 65536
>> Format specific information:
>>      compat: 1.1
>>      lazy refcounts: false
>>      refcount bits: 16
>>      corrupt: false
>>
>> and  I tried to qemu-img map --output json xxxx.img, as you can see,
>> the field of data always is true.
> Did you use metadata preallocation? If so, you explicitly requested all
> clusters to be allocated.

Yes,  I created the image with metadata preallocation. I see. its why 
qcow2_get_cluster_type always return QCOW2_CLUSTER_NORMAL.

>
>>> detect_zeroes does not preserve sparseness, but detect zeroes in parts
>>> of the source image that are not sparse, and make them sparse in the
>>> target image. This means that it has higher overhead (because all
>>> sectors need to be processed before copying them) and doesn't result in
>>> an exact copy. There may be cases where this is wanted, but in the
>>> common case, it's probably not the right mode of operation.
>> To be frank, customers are more concerned about sparseness than overhead.
> All generalisations are wrong.
>
> We could be talking about the majority of users (the QEMU project
> doesn't have customers),

The majority of users.:-) forgive my word.
>   but even then I doubt you're right, especially
> when using preallocation which is a tool for giving up sparseness in
> favour of improved performance of the first write to a cluster.

This patch is able to handle this case.  In fact I only hope to use 
preallocation to improve performance rather than become a sparseness 
image while live migrating.
it would waste a large mount of disk space, as most of our VM's data 
disk(/dev/vdb) is larger than 1TB. As you said,  We can use 
blockdev-mirror and manually enable detect-zeros
on new qemu verison(>2.6), but for less than 2.6, we also need to do it 
in drive-mirror.

>
>>> If you really want to detect zeroes, create the target block driver node
>>> manually (with detect-zeroes=on) and use the blockdev-mirror QMP command
>>> to mirror to it.
>> the target block is created by **bdrv_img_create** and opened by
>> **bdrv_open** inside qmp_drive_mirror, it also mean than we only
>> enable detect-zeroes while
>> its opened, i don't find qmp cmd to only enable it, if I understand
>> correctly.
> That's why I said you use blockdev-mirror instead drive-mirror.
Got it,  unfortunately  my qemu version does not contain this command. 
in order to use it, I also need to modify my libvirt.  its not 
temporarily available to do this. I would consider the my next release
to do it.:-)
>
> Kevin
>

      reply	other threads:[~2016-11-23  3:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-21  1:24 [Qemu-devel] [PATCH] block/mirror: enable detect zeroes when driving mirror Yang Wei
2016-11-21  1:34 ` no-reply
2016-11-21  6:51 ` Vasiliy Tolstov
2016-11-22  2:31   ` wyang
2016-11-22 13:44     ` Eric Blake
2016-11-23  3:14       ` wyang
2016-11-21 11:34 ` [Qemu-devel] [Qemu-block] " Kevin Wolf
2016-11-22  3:45   ` wyang
2016-11-22 10:09     ` Kevin Wolf
2016-11-23  3:12       ` wyang [this message]

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=5835091A.5050107@gmail.com \
    --to=w90p710@gmail.com \
    --cc=jcody@redhat.com \
    --cc=kwolf@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.