qcow2: Fix qcow2_get_cluster_offset() for zero clusters
commita99dfb45f26bface6830ee5465e57bcdbc53c6c8
authorKevin Wolf <kwolf@redhat.com>
Wed, 4 Nov 2015 17:16:24 +0000 (4 18:16 +0100)
committerMax Reitz <mreitz@redhat.com>
Wed, 11 Nov 2015 15:55:29 +0000 (11 16:55 +0100)
treee6d948e6c24c2e01fc0c1316b172e916328e6123
parent342075fd0ec9dce87139d71a81e1dbbe5ab5d021
qcow2: Fix qcow2_get_cluster_offset() for zero clusters

When searching for contiguous zero clusters, we only need to check the
cluster type. Before this patch, an increasing offset (L2E_OFFSET_MASK)
was expected, so that the function never returned more than a single
zero cluster in practice. This patch fixes it to actually return as many
contiguous zero clusters as it can.

Cc: qemu-stable@nongnu.org
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-id: 1446657384-5907-1-git-send-email-kwolf@redhat.com
Signed-off-by: Max Reitz <mreitz@redhat.com>
block/qcow2-cluster.c