mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-11 03:24:58 -06:00
qcow2: Prepare count_contiguous_clusters() for external data file
Offset 0 can be valid for normal (allocated) clusters now, so use qcow2_get_cluster_type() instead. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
a4ea184d8a
commit
b8c8353a38
1 changed files with 2 additions and 2 deletions
|
@ -389,12 +389,12 @@ static int count_contiguous_clusters(BlockDriverState *bs, int nb_clusters,
|
||||||
uint64_t first_entry = be64_to_cpu(l2_slice[0]);
|
uint64_t first_entry = be64_to_cpu(l2_slice[0]);
|
||||||
uint64_t offset = first_entry & mask;
|
uint64_t offset = first_entry & mask;
|
||||||
|
|
||||||
if (!offset) {
|
first_cluster_type = qcow2_get_cluster_type(bs, first_entry);
|
||||||
|
if (first_cluster_type == QCOW2_CLUSTER_UNALLOCATED) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* must be allocated */
|
/* must be allocated */
|
||||||
first_cluster_type = qcow2_get_cluster_type(bs, first_entry);
|
|
||||||
assert(first_cluster_type == QCOW2_CLUSTER_NORMAL ||
|
assert(first_cluster_type == QCOW2_CLUSTER_NORMAL ||
|
||||||
first_cluster_type == QCOW2_CLUSTER_ZERO_ALLOC);
|
first_cluster_type == QCOW2_CLUSTER_ZERO_ALLOC);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue