On 05/01/2018 11:57 AM, Max Reitz wrote:
Currently, qemu-img convert writes zeroes when it reads zeroes.
Sometimes it does not because the target is initialized to zeroes
anyway, so we do not need to overwrite (and thus potentially allocate)
it.  This is never the case for targets with backing files, though.  But
even them may have an area that is initialized to zeroes, and that is

s/them/they/

the area past the end of the backing file (if that is shorter than the
overlay).

So if the target format's unallocated blocks are zero and there is a gap
between the target's backing file's end and the target's end, we do not
have to explicitly write zeroes there.

Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1527898
Signed-off-by: Max Reitz <mre...@redhat.com>
---
  qemu-img.c | 26 +++++++++++++++++++++++++-
  1 file changed, 25 insertions(+), 1 deletion(-)


Some long variable names, but it aids legibility.  Nice fix.

Reviewed-by: Eric Blake <ebl...@redhat.com>

(And here's hoping that Red Hat someday flips the switch so that new images avoid compat=0.10 in their downstream builds, as we've had quite a few corner cases where we already have optimized speed for compat=1.1 ...)

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Reply via email to