[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 16/19] bitmap: Update count after a merge
From: |
John Snow |
Subject: |
[Qemu-devel] [PULL 16/19] bitmap: Update count after a merge |
Date: |
Mon, 29 Oct 2018 17:24:58 -0400 |
From: Eric Blake <address@hidden>
We need an accurate count of the number of bits set in a bitmap
after a merge. In particular, since the merge operation short-circuits
a merge from an empty source, if you have bitmaps A, B, and C where
B started empty, then merge C into B, and B into A, an inaccurate
count meant that A did not get the contents of C.
In the worst case, we may falsely regard the bitmap as empty when
it has had new writes merged into it.
Fixes: be58721db
CC: address@hidden
Signed-off-by: Eric Blake <address@hidden>
Signed-off-by: John Snow <address@hidden>
Reviewed-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Message-id: address@hidden
Signed-off-by: John Snow <address@hidden>
---
util/hbitmap.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/util/hbitmap.c b/util/hbitmap.c
index d5aca5159f..8d402c59d9 100644
--- a/util/hbitmap.c
+++ b/util/hbitmap.c
@@ -759,6 +759,9 @@ bool hbitmap_merge(const HBitmap *a, const HBitmap *b,
HBitmap *result)
}
}
+ /* Recompute the dirty count */
+ result->count = hb_count_between(result, 0, result->size - 1);
+
return true;
}
--
2.14.5
- [Qemu-devel] [PULL 04/19] dirty-bitmap: make it possible to restore bitmap after merge, (continued)
- [Qemu-devel] [PULL 04/19] dirty-bitmap: make it possible to restore bitmap after merge, John Snow, 2018/10/29
- [Qemu-devel] [PULL 09/19] bloc/qcow2: drop dirty_bitmaps_loaded state variable, John Snow, 2018/10/29
- [Qemu-devel] [PULL 10/19] block/dirty-bitmaps: add user_locked status checker, John Snow, 2018/10/29
- [Qemu-devel] [PULL 13/19] block/dirty-bitmaps: prohibit enable/disable on locked/frozen bitmaps, John Snow, 2018/10/29
- [Qemu-devel] [PULL 12/19] block/dirty-bitmaps: allow clear on disabled bitmaps, John Snow, 2018/10/29
- [Qemu-devel] [PULL 11/19] block/dirty-bitmaps: fix merge permissions, John Snow, 2018/10/29
- [Qemu-devel] [PULL 18/19] iotests: improve 169, John Snow, 2018/10/29
- [Qemu-devel] [PULL 19/19] iotests: 169: add cases for source vm resuming, John Snow, 2018/10/29
- [Qemu-devel] [PULL 15/19] nbd: forbid use of frozen bitmaps, John Snow, 2018/10/29
- [Qemu-devel] [PULL 14/19] block/backup: prohibit backup from using in use bitmaps, John Snow, 2018/10/29
- [Qemu-devel] [PULL 16/19] bitmap: Update count after a merge,
John Snow <=
- [Qemu-devel] [PULL 17/19] dirty-bitmaps: clean-up bitmaps loading and migration logic, John Snow, 2018/10/29
- Re: [Qemu-devel] [PULL 00/19] Bitmaps patches, Peter Maydell, 2018/10/30