From 3fec237fca3bfdd4b6cc4749a9fa737062fb6611 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Date: Tue, 8 Sep 2020 16:08:28 +0200 Subject: qcow2: Make qcow2_free_any_clusters() free only one cluster This function takes an L2 entry and a number of clusters to free. Although in principle it can free any type of cluster (using the L2 entry to determine its type) in practice the API is broken because compressed clusters have a variable size and there is no way to free more than one without having the L2 entry of each one of them. The good news all callers are passing nb_clusters=1 so we can simply get rid of that parameter. Signed-off-by: Alberto Garcia Message-Id: <77cea0f4616f921d37e971b3c5b18a2faa24b173.1599573989.git.berto@igalia.com> Reviewed-by: Kevin Wolf Signed-off-by: Max Reitz --- block/qcow2.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'block/qcow2.h') diff --git a/block/qcow2.h b/block/qcow2.h index 83cfa0c391..b73a4cf1f8 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -861,8 +861,8 @@ int64_t qcow2_alloc_bytes(BlockDriverState *bs, int size); void qcow2_free_clusters(BlockDriverState *bs, int64_t offset, int64_t size, enum qcow2_discard_type type); -void qcow2_free_any_clusters(BlockDriverState *bs, uint64_t l2_entry, - int nb_clusters, enum qcow2_discard_type type); +void qcow2_free_any_cluster(BlockDriverState *bs, uint64_t l2_entry, + enum qcow2_discard_type type); int qcow2_update_snapshot_refcount(BlockDriverState *bs, int64_t l1_table_offset, int l1_size, int addend); -- cgit v1.2.3