[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH v5 1/5] qcow2-refcount: fix check_oflag_copied
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[Qemu-block] [PATCH v5 1/5] qcow2-refcount: fix check_oflag_copied |
Date: |
Wed, 27 Feb 2019 16:14:29 +0300 |
Increase corruptions_fixed only after successful fix.
Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
---
block/qcow2-refcount.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index 6f13d470d3..16e8942343 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -1825,7 +1825,7 @@ static int check_oflag_copied(BlockDriverState *bs,
BdrvCheckResult *res,
for (i = 0; i < s->l1_size; i++) {
uint64_t l1_entry = s->l1_table[i];
uint64_t l2_offset = l1_entry & L1E_OFFSET_MASK;
- bool l2_dirty = false;
+ int l2_dirty = 0;
if (!l2_offset) {
continue;
@@ -1887,8 +1887,7 @@ static int check_oflag_copied(BlockDriverState *bs,
BdrvCheckResult *res,
l2_table[j] = cpu_to_be64(refcount == 1
? l2_entry | QCOW_OFLAG_COPIED
: l2_entry & ~QCOW_OFLAG_COPIED);
- l2_dirty = true;
- res->corruptions_fixed++;
+ l2_dirty++;
} else {
res->corruptions++;
}
@@ -1896,7 +1895,7 @@ static int check_oflag_copied(BlockDriverState *bs,
BdrvCheckResult *res,
}
}
- if (l2_dirty) {
+ if (l2_dirty > 0) {
ret = qcow2_pre_write_overlap_check(bs, QCOW2_OL_ACTIVE_L2,
l2_offset, s->cluster_size);
if (ret < 0) {
@@ -1914,6 +1913,7 @@ static int check_oflag_copied(BlockDriverState *bs,
BdrvCheckResult *res,
res->check_errors++;
goto fail;
}
+ res->corruptions_fixed += l2_dirty;
}
}
--
2.18.0