[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 01/11] qcow2-refcount: fix check_oflag_copied
From: |
Max Reitz |
Subject: |
[Qemu-block] [PULL 01/11] qcow2-refcount: fix check_oflag_copied |
Date: |
Tue, 7 May 2019 17:18:09 +0200 |
From: Vladimir Sementsov-Ogievskiy <address@hidden>
Increase corruptions_fixed only after successful fix.
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 | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index e0fe322500..ed3d8ebd57 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -1846,7 +1846,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;
@@ -1912,8 +1912,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++;
}
@@ -1921,7 +1920,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,
false);
@@ -1940,6 +1939,7 @@ static int check_oflag_copied(BlockDriverState *bs,
BdrvCheckResult *res,
res->check_errors++;
goto fail;
}
+ res->corruptions_fixed += l2_dirty;
}
}
--
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 <=
- [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, 2019/05/07
- [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