diff options
author | Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | 2019-02-27 16:14:29 +0300 |
---|---|---|
committer | Max Reitz <mreitz@redhat.com> | 2019-05-07 17:14:21 +0200 |
commit | 7e3e736cbd37a633ed5673de4254424745fbf520 (patch) | |
tree | 40f14b30c9667d0bbe09bac141db3669f71e5733 /block/qcow2-refcount.c | |
parent | 19eb2d4e736dc895f31fbd6b520e514f10cc08e0 (diff) |
qcow2-refcount: fix check_oflag_copied
Increase corruptions_fixed only after successful fix.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-id: 20190227131433.197063-2-vsementsov@virtuozzo.com
Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block/qcow2-refcount.c')
-rw-r--r-- | block/qcow2-refcount.c | 8 |
1 files 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; } } |