]> git.proxmox.com Git - mirror_qemu.git/commit
qemu-img: Use BDRV_REQ_NO_FALLBACK for pre-zeroing
authorKevin Wolf <kwolf@redhat.com>
Fri, 22 Mar 2019 12:49:28 +0000 (13:49 +0100)
committerKevin Wolf <kwolf@redhat.com>
Tue, 26 Mar 2019 10:37:51 +0000 (11:37 +0100)
commitc9fdcf202f19fc2acdcb1ee0522ff5d61bf8c906
treed5513b1628f3f10684f539134e87adcccc97f622
parent738301e11758171defaa5a5237d584f8226af89f
qemu-img: Use BDRV_REQ_NO_FALLBACK for pre-zeroing

If qemu-img convert sees that the target image isn't zero-initialised
yet, it tries to do an efficient zero write for the whole image first
to save the overhead of repeated explicit zero writes during the
conversion. Obviously, this provides only an advantage if the
pre-zeroing is actually efficient. Otherwise, we can end up writing
zeroes slowly while zeroing out the whole image, and then overwrite the
same blocks again with real data, potentially doubling the written data.

Pass BDRV_REQ_NO_FALLBACK to blk_make_zero() to avoid this case. If we
can't efficiently zero out, we'll instead write explicit zeroes only if
there is no data to be written to a block.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Acked-by: Eric Blake <eblake@redhat.com>
qemu-img.c