[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [RFC PATCH 05/11] qcow2: Prepare count_contiguous_clusters(
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [RFC PATCH 05/11] qcow2: Prepare count_contiguous_clusters() for external data file |
Date: |
Thu, 31 Jan 2019 18:55:43 +0100 |
Offset 0 can be valid for normal (allocated) clusters now, so use
qcow2_get_cluster_type() instead.
Signed-off-by: Kevin Wolf <address@hidden>
---
block/qcow2-cluster.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
index 7c86e3f205..73ea0f99d6 100644
--- a/block/qcow2-cluster.c
+++ b/block/qcow2-cluster.c
@@ -386,12 +386,12 @@ static int count_contiguous_clusters(BlockDriverState
*bs, int nb_clusters,
uint64_t first_entry = be64_to_cpu(l2_slice[0]);
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;
}
/* must be allocated */
- first_cluster_type = qcow2_get_cluster_type(bs, first_entry);
assert(first_cluster_type == QCOW2_CLUSTER_NORMAL ||
first_cluster_type == QCOW2_CLUSTER_ZERO_ALLOC);
--
2.20.1
- [Qemu-block] [RFC PATCH 00/11] qcow2: External data files, Kevin Wolf, 2019/01/31
- [Qemu-block] [RFC PATCH 02/11] qcow2: Basic definitions for external data files, Kevin Wolf, 2019/01/31
- [Qemu-block] [RFC PATCH 01/11] qcow2: Extend spec for external data files, Kevin Wolf, 2019/01/31
- [Qemu-block] [RFC PATCH 03/11] qcow2: Pass bs to qcow2_get_cluster_type(), Kevin Wolf, 2019/01/31
- [Qemu-block] [RFC PATCH 04/11] qcow2: Prepare qcow2_get_cluster_type() for external data file, Kevin Wolf, 2019/01/31
- [Qemu-block] [RFC PATCH 05/11] qcow2: Prepare count_contiguous_clusters() for external data file,
Kevin Wolf <=
- [Qemu-block] [RFC PATCH 06/11] qcow2: Don't assume 0 is an invalid cluster offset, Kevin Wolf, 2019/01/31
- [Qemu-block] [RFC PATCH 07/11] qcow2: External file I/O, Kevin Wolf, 2019/01/31
- [Qemu-block] [RFC PATCH 08/11] qcow2: Add basic data-file infrastructure, Kevin Wolf, 2019/01/31
- [Qemu-block] [RFC PATCH 09/11] qcow2: Creating images with external data file, Kevin Wolf, 2019/01/31
- [Qemu-block] [RFC PATCH 11/11] qcow2: Add data file to ImageInfoSpecificQCow2, Kevin Wolf, 2019/01/31
- [Qemu-block] [RFC PATCH 10/11] qcow2: Store data file name in the image, Kevin Wolf, 2019/01/31
- Re: [Qemu-block] [RFC PATCH 00/11] qcow2: External data files, Nir Soffer, 2019/01/31