@@ -896,6 +896,9 @@ int qcow2_shrink_reftable(BlockDriverState *bs);
int64_t qcow2_get_last_cluster(BlockDriverState *bs, int64_t size);
int qcow2_detect_metadata_preallocation(BlockDriverState *bs);
+void qcow2_cache_host_discard(BlockDriverState *bs,
+ uint64_t offset, uint64_t length);
+
/* qcow2-cluster.c functions */
int qcow2_grow_l1_table(BlockDriverState *bs, uint64_t min_size,
bool exact_size);
@@ -749,8 +749,8 @@ void qcow2_process_discards(BlockDriverState *bs, int ret)
}
}
-static void update_refcount_discard(BlockDriverState *bs,
- uint64_t offset, uint64_t length)
+void qcow2_cache_host_discard(BlockDriverState *bs,
+ uint64_t offset, uint64_t length)
{
BDRVQcow2State *s = bs->opaque;
Qcow2DiscardRegion *d, *p, *next;
@@ -901,7 +901,7 @@ static int QEMU_WARN_UNUSED_RESULT update_refcount(BlockDriverState *bs,
}
if (s->discard_passthrough[type]) {
- update_refcount_discard(bs, cluster_offset, s->cluster_size);
+ qcow2_cache_host_discard(bs, cluster_offset, s->cluster_size);
}
}
}
@@ -3369,7 +3369,7 @@ static int qcow2_discard_refcount_block(BlockDriverState *bs,
/* discard refblock from the cache if refblock is cached */
qcow2_cache_discard(s->refcount_block_cache, refblock);
}
- update_refcount_discard(bs, discard_block_offs, s->cluster_size);
+ qcow2_cache_host_discard(bs, discard_block_offs, s->cluster_size);
return 0;
}
Make the function public to be reused later. Make it's name to show what function does instead of where it is called. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> --- block/qcow2.h | 3 +++ block/qcow2-refcount.c | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-)