[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5 15/31] qcow2: Add qcow2_cluster_is_allocated()
From: |
Alberto Garcia |
Subject: |
[PATCH v5 15/31] qcow2: Add qcow2_cluster_is_allocated() |
Date: |
Tue, 5 May 2020 19:38:15 +0200 |
This helper function tells us if a cluster is allocated (that is,
there is an associated host offset for it).
Signed-off-by: Alberto Garcia <address@hidden>
---
block/qcow2.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/block/qcow2.h b/block/qcow2.h
index be7816a3b8..b5db8d2f36 100644
--- a/block/qcow2.h
+++ b/block/qcow2.h
@@ -763,6 +763,12 @@ QCow2SubclusterType
qcow2_get_subcluster_type(BlockDriverState *bs,
}
}
+static inline bool qcow2_cluster_is_allocated(QCow2ClusterType type)
+{
+ return (type == QCOW2_CLUSTER_COMPRESSED || type == QCOW2_CLUSTER_NORMAL ||
+ type == QCOW2_CLUSTER_ZERO_ALLOC);
+}
+
/* Check whether refcounts are eager or lazy */
static inline bool qcow2_need_accurate_refcounts(BDRVQcow2State *s)
{
--
2.20.1
- [PATCH v5 29/31] qcow2: Assert that expand_zero_clusters_in_l1() does not support subclusters, (continued)
[PATCH v5 14/31] qcow2: Add QCow2SubclusterType and qcow2_get_subcluster_type(), Alberto Garcia, 2020/05/05
[PATCH v5 15/31] qcow2: Add qcow2_cluster_is_allocated(),
Alberto Garcia <=
[PATCH v5 17/31] qcow2: Replace QCOW2_CLUSTER_* with QCOW2_SUBCLUSTER_*, Alberto Garcia, 2020/05/05
[PATCH v5 31/31] iotests: Add tests for qcow2 images with extended L2 entries, Alberto Garcia, 2020/05/05
[PATCH v5 07/31] qcow2: Document the Extended L2 Entries feature, Alberto Garcia, 2020/05/05
[PATCH v5 04/31] qcow2: Split cluster_needs_cow() out of count_cow_clusters(), Alberto Garcia, 2020/05/05
[PATCH v5 23/31] qcow2: Add subcluster support to check_refcounts_l2(), Alberto Garcia, 2020/05/05