Re: qcow2 preallocation and backing files

2019-11-21 Thread Max Reitz
On 20.11.19 16:58, Vladimir Sementsov-Ogievskiy wrote: > 20.11.2019 18:18, Alberto Garcia wrote: >> On Wed 20 Nov 2019 01:27:53 PM CET, Vladimir Semeeausntsov-Ogievskiy wrote: >> >>> 3. Also, the latter way is inconsistent with discard. Discarded >>> regions returns zeroes, not clusters from backin

Re: qcow2 preallocation and backing files

2019-11-20 Thread Vladimir Sementsov-Ogievskiy
20.11.2019 19:46, Kevin Wolf wrote: > Am 20.11.2019 um 16:58 hat Vladimir Sementsov-Ogievskiy geschrieben: >> 20.11.2019 18:18, Alberto Garcia wrote: >>> On Wed 20 Nov 2019 01:27:53 PM CET, Vladimir Semeeausntsov-Ogievskiy wrote: >>> 3. Also, the latter way is inconsistent with discard. Discar

Re: qcow2 preallocation and backing files

2019-11-20 Thread Kevin Wolf
Am 20.11.2019 um 16:58 hat Vladimir Sementsov-Ogievskiy geschrieben: > 20.11.2019 18:18, Alberto Garcia wrote: > > On Wed 20 Nov 2019 01:27:53 PM CET, Vladimir Semeeausntsov-Ogievskiy wrote: > > > >> 3. Also, the latter way is inconsistent with discard. Discarded > >> regions returns zeroes, not c

Re: qcow2 preallocation and backing files

2019-11-20 Thread Alberto Garcia
On Wed 20 Nov 2019 04:58:38 PM CET, Vladimir Sementsov-Ogievskiy wrote: >> But then PREALLOC_MODE_OFF implies that the L2 metadata should be >> preallocated (all clusters should be QCOW2_CLUSTER_ZERO_PLAIN), at >> least when there is a backing file. > > Kevin proposed a fix that alters PREALLOC_MOD

Re: qcow2 preallocation and backing files

2019-11-20 Thread Vladimir Sementsov-Ogievskiy
20.11.2019 18:18, Alberto Garcia wrote: > On Wed 20 Nov 2019 01:27:53 PM CET, Vladimir Semeeausntsov-Ogievskiy wrote: > >> 3. Also, the latter way is inconsistent with discard. Discarded >> regions returns zeroes, not clusters from backing. I think discard and >> truncate should behave in the same

Re: qcow2 preallocation and backing files

2019-11-20 Thread Alberto Garcia
On Wed 20 Nov 2019 01:27:53 PM CET, Vladimir Semeeausntsov-Ogievskiy wrote: > 3. Also, the latter way is inconsistent with discard. Discarded > regions returns zeroes, not clusters from backing. I think discard and > truncate should behave in the same safe zero way. But then PREALLOC_MODE_OFF imp

Re: qcow2 preallocation and backing files

2019-11-20 Thread Vladimir Sementsov-Ogievskiy
20.11.2019 15:06, Alberto Garcia wrote: > Hi, > > as we discussed yesterday on IRC there's an inconsistency in the way > qcow2 preallocation works. > > Let's create an image and fill it with data: > > $ qemu-img create -f raw base.img 1M > $ qemu-io -f raw -c 'write -P 0xFF 0 1M' base.im

qcow2 preallocation and backing files

2019-11-20 Thread Alberto Garcia
Hi, as we discussed yesterday on IRC there's an inconsistency in the way qcow2 preallocation works. Let's create an image and fill it with data: $ qemu-img create -f raw base.img 1M $ qemu-io -f raw -c 'write -P 0xFF 0 1M' base.img Now QEMU won't let us create a new image backed by base.i