]> git.proxmox.com Git - mirror_qemu.git/commit
qcow2: Don't assume 0 is an invalid cluster offset
authorKevin Wolf <kwolf@redhat.com>
Fri, 18 Jan 2019 13:40:36 +0000 (14:40 +0100)
committerKevin Wolf <kwolf@redhat.com>
Fri, 8 Mar 2019 11:26:45 +0000 (12:26 +0100)
commitc6d619cc12813acb2b1198f28cf2256ea9a30107
treeba8aed5c59a1a2b39eafc37750d3c82dd6f6e259
parentb8c8353a38296fbb92e05a2843e853c1ddfc2674
qcow2: Don't assume 0 is an invalid cluster offset

The cluster allocation code uses 0 as an invalid offset that is used in
case of errors or as "offset not yet determined". With external data
files, a host cluster offset of 0 becomes valid, though.

Define a constant INV_OFFSET (which is not cluster aligned and will
therefore never be a valid offset) that can be used for such purposes.

This removes the additional host_offset == 0 check that commit
ff52aab2df5 introduced; the confusion between an invalid offset and
(erroneous) allocation at offset 0 is removed with this change.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/qcow2-cluster.c
block/qcow2.h