Commit a119eb9f4e for qemu.org
commit a119eb9f4e5c30677bbc227f104f42c73d11b4a8
Author: Denis V. Lunev <den@openvz.org>
Date: Fri Oct 30 02:06:08 2026 +0100
block/block-copy: rename block_copy_is_cluster_allocated()
Since it started filling zero_bitmap, the function does more than its
name says: it is the scan's block-status query, reporting allocation and
recording zeroes. Rename it to block_copy_scan_status() and say so in
its comment. No behavior change.
Suggested-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
CC: John Snow <jsnow@redhat.com>
CC: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
Message-ID: <20261030010613.1612771-9-den@openvz.org>
Signed-off-by: Eric Blake <eblake@redhat.com>
diff --git a/block/block-copy.c b/block/block-copy.c
index 4f128a0ebd..ad358f4d2f 100644
--- a/block/block-copy.c
+++ b/block/block-copy.c
@@ -708,13 +708,13 @@ static void block_copy_mark_zero_prefix(BlockCopyState *s, int64_t offset,
}
/*
- * Check if the cluster starting at offset is allocated or not.
- * return via pnum the number of contiguous clusters sharing this allocation.
- * Also marks the zero prefix of the range in zero_bitmap.
+ * One block-status query of the scan at @offset: return 1 if the cluster
+ * there is allocated, 0 if not, -errno on failure, and via @pnum the number
+ * of contiguous clusters sharing that allocation. Their zero prefix goes
+ * into zero_bitmap.
*/
static int coroutine_fn GRAPH_RDLOCK
-block_copy_is_cluster_allocated(BlockCopyState *s, int64_t offset,
- int64_t *pnum)
+block_copy_scan_status(BlockCopyState *s, int64_t offset, int64_t *pnum)
{
BlockDriverState *bs = s->source->bs;
BlockDriverState *base = block_copy_status_base(s);
@@ -793,7 +793,7 @@ int64_t coroutine_fn block_copy_reset_unallocated(BlockCopyState *s,
int ret;
int64_t clusters, bytes;
- ret = block_copy_is_cluster_allocated(s, offset, &clusters);
+ ret = block_copy_scan_status(s, offset, &clusters);
if (ret < 0) {
return ret;
}
@@ -837,7 +837,7 @@ block_copy_calculate_zero_bitmap(BlockCopyState *s, int64_t offset,
if (*cached_end < dirty_end) {
int64_t clusters;
int64_t query_offset = MAX(dirty_offset, *cached_end);
- int ret = block_copy_is_cluster_allocated(s, query_offset, &clusters);
+ int ret = block_copy_scan_status(s, query_offset, &clusters);
if (ret >= 0) {
*cached_end = query_offset + clusters * s->cluster_size;