[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH] bitmap: Update count after a merge
From: |
Eric Blake |
Subject: |
[Qemu-block] [PATCH] bitmap: Update count after a merge |
Date: |
Wed, 26 Sep 2018 22:11:31 -0500 |
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.
Fixes: be58721db
CC: address@hidden
Signed-off-by: Eric Blake <address@hidden>
---
Probably worth some testsuite coverage, but for a late-night one-liner,
this is as much as I can do today.
util/hbitmap.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/util/hbitmap.c b/util/hbitmap.c
index bcd304041aa..52e12da4b48 100644
--- a/util/hbitmap.c
+++ b/util/hbitmap.c
@@ -753,3 +753,4 @@ bool hbitmap_merge(HBitmap *a, const HBitmap *b)
a->levels[i][j] |= b->levels[i][j];
}
}
+ a->count = hb_count_between(a, 0, a->size - 1);
return true;
}
--
2.17.1
- [Qemu-block] [PATCH] bitmap: Update count after a merge,
Eric Blake <=