[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH] util/hbitmaps: recalculate count on merge
From: |
John Snow |
Subject: |
[Qemu-block] [PATCH] util/hbitmaps: recalculate count on merge |
Date: |
Wed, 26 Sep 2018 17:28:14 -0400 |
We have been neglecting to do so, which results in wrong counts
after merge. In the worst case, we may think the bitmap is empty
when it has had new writes merged into it.
Reported-by: Eric Blake <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..28e9c523ab 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 */
+ a->count = hb_count_between(a, 0, a->size - 1);
+
return true;
}
--
2.14.4
- [Qemu-block] [PATCH] util/hbitmaps: recalculate count on merge,
John Snow <=