On 4/15/19 10:54 AM, Kevin Wolf wrote: > preallocate_co() already gave the data file the full size without > forwarding the requested preallocation mode to the protocol. When > bdrv_co_truncate() was called later with the preallocation mode, the > file didn't actually grow any more, so the data file stayed unallocated > even if full preallocation was requested. > > Pass the right preallocation mode to preallocate_co() and remove the > second bdrv_co_truncate() to fix this. As a side effect, the ugly > one-byte write in preallocate_co() is replaced with a truncate call, > now leaving the last block unallocated on the protocol level as it > should be. > > Cc: qemu-sta...@nongnu.org > Signed-off-by: Kevin Wolf <kw...@redhat.com> > --- > block/qcow2.c | 41 +++++++++++++++++++++++------------------ > 1 file changed, 23 insertions(+), 18 deletions(-) >
Reviewed-by: Eric Blake <ebl...@redhat.com> Worth iotest coverage? -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature