Re: [Qemu-block] [PATCH 3/3] block: mirror - zero unallocated target sectors when zero init not present

2015-10-01 Thread Kevin Wolf
Am 30.09.2015 um 17:11 hat Jeff Cody geschrieben: > On Mon, Sep 28, 2015 at 04:23:16PM +0100, Stefan Hajnoczi wrote: > > On Sun, Sep 27, 2015 at 11:29:18PM -0400, Jeff Cody wrote: > > > +if (s->zero_cycle) { > > > +ret = bdrv_get_block_status(s->target, sector_num, nb_sectors, > > >

Re: [Qemu-block] [PATCH 3/3] block: mirror - zero unallocated target sectors when zero init not present

2015-10-01 Thread Jeff Cody
On Mon, Sep 28, 2015 at 04:23:16PM +0100, Stefan Hajnoczi wrote: > On Sun, Sep 27, 2015 at 11:29:18PM -0400, Jeff Cody wrote: > > +if (s->zero_cycle) { > > +ret = bdrv_get_block_status(s->target, sector_num, nb_sectors, > > ); > > +if (!(ret & BDRV_BLOCK_ZERO)) { > > +

Re: [Qemu-block] [PATCH 3/3] block: mirror - zero unallocated target sectors when zero init not present

2015-09-30 Thread Paolo Bonzini
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 On 29/09/2015 10:39, Kevin Wolf wrote: > bdrv_has_zero_init() takes care of that, in theory. The "problem" > here is that the target is opened with BDRV_O_NO_BACKING, so the > block layer doesn't consider this an image with a backing file. I

Re: [Qemu-block] [PATCH 3/3] block: mirror - zero unallocated target sectors when zero init not present

2015-09-29 Thread Kevin Wolf
Am 28.09.2015 um 19:32 hat Max Reitz geschrieben: > On 28.09.2015 05:29, Jeff Cody wrote: > > During mirror, if the target device does not have support zero > > initialization, a mirror may result in a corrupt image. > > > > For instance, on mirror to a host device with format = raw, whatever > >

Re: [Qemu-block] [PATCH 3/3] block: mirror - zero unallocated target sectors when zero init not present

2015-09-28 Thread Paolo Bonzini
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". The reasons are: 1) with sync

Re: [Qemu-block] [PATCH 3/3] block: mirror - zero unallocated target sectors when zero init not present

2015-09-28 Thread Kevin Wolf
Am 28.09.2015 um 05:29 hat Jeff Cody geschrieben: > During mirror, if the target device does not have support zero > initialization, a mirror may result in a corrupt image. I think you want to check this sentence. ("During mirror [...], a mirror may result [...]") > For instance, on mirror to a

Re: [Qemu-block] [PATCH 3/3] block: mirror - zero unallocated target sectors when zero init not present

2015-09-28 Thread Kevin Wolf
Am 28.09.2015 um 05:29 hat Jeff Cody geschrieben: > During mirror, if the target device does not have support zero > initialization, a mirror may result in a corrupt image. > > For instance, on mirror to a host device with format = raw, whatever > random data is on the target device will still be

Re: [Qemu-block] [PATCH 3/3] block: mirror - zero unallocated target sectors when zero init not present

2015-09-28 Thread Stefan Hajnoczi
On Sun, Sep 27, 2015 at 11:29:18PM -0400, Jeff Cody wrote: > +if (s->zero_cycle) { > +ret = bdrv_get_block_status(s->target, sector_num, nb_sectors, > ); > +if (!(ret & BDRV_BLOCK_ZERO)) { > +bdrv_aio_write_zeroes(s->target, sector_num, op->nb_sectors, > +

Re: [Qemu-block] [PATCH 3/3] block: mirror - zero unallocated target sectors when zero init not present

2015-09-28 Thread Max Reitz
On 28.09.2015 05:29, Jeff Cody wrote: > During mirror, if the target device does not have support zero > initialization, a mirror may result in a corrupt image. > > For instance, on mirror to a host device with format = raw, whatever > random data is on the target device will still be there for

[Qemu-block] [PATCH 3/3] block: mirror - zero unallocated target sectors when zero init not present

2015-09-27 Thread Jeff Cody
During mirror, if the target device does not have support zero initialization, a mirror may result in a corrupt image. For instance, on mirror to a host device with format = raw, whatever random data is on the target device will still be there for unallocated sectors. This is because during the