On 09/28/2015 08:13 AM, Paolo Bonzini wrote: > > > On 28/09/2015 05:29, Jeff Cody wrote: >> This only occurs under two conditions: >> >> 1. 'mode' != "existing" >> 2. bdrv_has_zero_init(target) == NULL >> > > I'm not sure if mode != "existing" actually matters. I think what > actually matters is sync == "full".
When mode == 'existing' for a shallow mirror (sync != 'full'), that is the caller stating that the guest-visible contents of the destination match the guest-visible contents of the backing image. The only sectors to be copied are those that differ from the backing file, and we should not be zeroing unrelated sectors because the user has already promised they have the same guest-visible content as the backing image would report. When mode == 'existing' for a full mirror (sync == 'full'), that is the caller stating that they want every single sector of the destination written to hold the current state of the source (of course, allowing for optimizations such as skipping the write where the contents will read back the same as if the write had been performed). I think Paolo is right: we care about zeroing unallocated sectors for sync == 'full', regardless of whether mode == 'existing'. I also think the reason Jeff confused it for mode == 'existing' is that the other modes let qemu create the file, but qemu does not create block devices (the only way to mirror to a block device is via mode == 'existing'), and it is primarily block devices where zero init is not guaranteed. > > The reasons are: > > 1) with sync != "full", unallocated target sectors should remain > unallocated on the destination because they are supposed to point to the > backing file. > > 2) even with mode == "existing" you expect the data to be consistent at > the end of the mirroring > > Paolo > > -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature