Am 28.09.2015 um 22:31 hat Eric Blake geschrieben: > 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.
Where is this promise documented? I wasn't aware of it and can't seem to find it in the QAPI documentation of drive-mirror. > 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 agree. > 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. 'qemu-img create' works on block devices (even though for raw it doesn't do more than checking if it's large enough; but for qcow2, it's obvious that it's necessary), so I'm pretty sure that mode != 'existing' works on them as well. Kevin
pgpyZ4wI2es8h.pgp
Description: PGP signature