mirror of
https://github.com/qemu/qemu.git
synced 2024-11-23 19:03:38 +08:00
bitmap: Update count after a merge
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: qemu-stable@nongnu.org Signed-off-by: Eric Blake <eblake@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-id: 20181002233314.30159-1-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com> (cherry picked from commitd1dde7149e
) *drop functional dep. onfa000f2f
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
This commit is contained in:
parent
7b8e8ff009
commit
5d64550dc5
@ -754,6 +754,9 @@ bool hbitmap_merge(HBitmap *a, const HBitmap *b)
|
||||
}
|
||||
}
|
||||
|
||||
/* Recompute the dirty count */
|
||||
a->count = hb_count_between(a, 0, a->size - 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user