]> git.proxmox.com Git - mirror_qemu.git/commit - block/qcow2.c
qcow2: Catch more unaligned write_zero into zero cluster
authorEric Blake <eblake@redhat.com>
Thu, 26 May 2016 03:48:49 +0000 (21:48 -0600)
committerKevin Wolf <kwolf@redhat.com>
Wed, 8 Jun 2016 08:21:08 +0000 (10:21 +0200)
commitebb718a5c7240f6ffb308e0d0b67a92c3b63b91c
tree5cd35fa026f5a63fb8a4bb61fe922cbbc437ffaa
parent31ad4fdf914e86a2ea105ff3687a0f4dfc4802cb
qcow2: Catch more unaligned write_zero into zero cluster

is_zero_cluster() and is_zero_cluster_top_locked() are used only
by qcow2_co_write_zeroes().  The former is too broad (we don't
care if the sectors we are about to overwrite are non-zero, only
that all other sectors in the cluster are zero), so it needs to
be called up to twice but with smaller limits - rename it along
with adding the neeeded parameter.  The latter can be inlined for
more compact code.

The testsuite change shows that we now have a sparser top file
when an unaligned write_zeroes overwrites the only portion of
the backing file with data.

Based on a patch proposal by Denis V. Lunev.

CC: Denis V. Lunev <den@openvz.org>
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/qcow2.c
tests/qemu-iotests/154.out