[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 04/11] qcow2-refcount: check_refcounts_l2: don't coun
From: |
Max Reitz |
Subject: |
[Qemu-block] [PULL 04/11] qcow2-refcount: check_refcounts_l2: don't count fixed cluster as allocated |
Date: |
Tue, 7 May 2019 17:18:12 +0200 |
From: Vladimir Sementsov-Ogievskiy <address@hidden>
Do not count a cluster which is fixed to be ZERO as allocated.
Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
Message-id: address@hidden
Signed-off-by: Max Reitz <address@hidden>
---
block/qcow2-refcount.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index 1ac2b0490d..6851807ffc 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -1660,15 +1660,6 @@ static int check_refcounts_l2(BlockDriverState *bs,
BdrvCheckResult *res,
{
uint64_t offset = l2_entry & L2E_OFFSET_MASK;
- if (flags & CHECK_FRAG_INFO) {
- res->bfi.allocated_clusters++;
- if (next_contiguous_offset &&
- offset != next_contiguous_offset) {
- res->bfi.fragmented_clusters++;
- }
- next_contiguous_offset = offset + s->cluster_size;
- }
-
/* Correct offsets are cluster aligned */
if (offset_into_cluster(s, offset)) {
if (qcow2_get_cluster_type(bs, l2_entry) ==
@@ -1721,6 +1712,15 @@ static int check_refcounts_l2(BlockDriverState *bs,
BdrvCheckResult *res,
}
}
+ if (flags & CHECK_FRAG_INFO) {
+ res->bfi.allocated_clusters++;
+ if (next_contiguous_offset &&
+ offset != next_contiguous_offset) {
+ res->bfi.fragmented_clusters++;
+ }
+ next_contiguous_offset = offset + s->cluster_size;
+ }
+
/* Mark cluster as used */
if (!has_data_file(bs)) {
ret = qcow2_inc_refcounts_imrt(bs, res, refcount_table,
--
2.20.1
- [Qemu-block] [PULL 00/11] Block patches, Max Reitz, 2019/05/07
- [Qemu-block] [PULL 01/11] qcow2-refcount: fix check_oflag_copied, Max Reitz, 2019/05/07
- [Qemu-block] [PULL 02/11] qcow2-refcount: avoid eating RAM, Max Reitz, 2019/05/07
- [Qemu-block] [PULL 04/11] qcow2-refcount: check_refcounts_l2: don't count fixed cluster as allocated,
Max Reitz <=
- [Qemu-block] [PULL 05/11] qcow2-refcount: don't mask corruptions under internal errors, Max Reitz, 2019/05/07
- [Qemu-block] [PULL 03/11] qcow2-refcount: check_refcounts_l2: reduce ignored overlaps, Max Reitz, 2019/05/07
- [Qemu-block] [PULL 06/11] qcow2: discard bitmap when removed, Max Reitz, 2019/05/07
- [Qemu-block] [PULL 07/11] block/ssh: Implement .bdrv_refresh_filename(), Max Reitz, 2019/05/07
- [Qemu-block] [PULL 08/11] block/ssh: Implement .bdrv_dirname(), Max Reitz, 2019/05/07
- [Qemu-block] [PULL 09/11] block: Assert that drv->bdrv_child_perm is set in bdrv_child_perm(), Max Reitz, 2019/05/07
- [Qemu-block] [PULL 10/11] commit: Use bdrv_append() in commit_start(), Max Reitz, 2019/05/07
- [Qemu-block] [PULL 11/11] iotests: Fix iotests 110 and 126, Max Reitz, 2019/05/07
- Re: [Qemu-block] [PULL 00/11] Block patches, Peter Maydell, 2019/05/09