mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-21 00:53:27 -06:00
block: simplify handling of try to merge different sized bitmaps
We have too much logic to simply check that bitmaps are of the same size. Let's just define that hbitmap_merge() and bdrv_dirty_bitmap_merge_internal() require their argument bitmaps be of same size, this simplifies things. Let's look through the callers: For backup_init_bcs_bitmap() we already assert that merge can't fail. In bdrv_reclaim_dirty_bitmap_locked() we gracefully handle the error that can't happen: successor always has same size as its parent, drop this logic. In bdrv_merge_dirty_bitmap() we already has assertion and separate check. Make the check explicit and improve error message. Signed-off-by: Vladimir Sementsov-Ogievskiy <v.sementsov-og@mail.ru> Reviewed-by: Nikita Lapshin <nikita.lapshin@virtuozzo.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20220517111206.23585-4-v.sementsov-og@mail.ru> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
58cbfbdf73
commit
618af89e55
5 changed files with 23 additions and 51 deletions
|
@ -76,20 +76,9 @@ void hbitmap_truncate(HBitmap *hb, uint64_t size);
|
|||
*
|
||||
* Store result of merging @a and @b into @result.
|
||||
* @result is allowed to be equal to @a or @b.
|
||||
*
|
||||
* Return true if the merge was successful,
|
||||
* false if it was not attempted.
|
||||
* All bitmaps must have same size.
|
||||
*/
|
||||
bool hbitmap_merge(const HBitmap *a, const HBitmap *b, HBitmap *result);
|
||||
|
||||
/**
|
||||
* hbitmap_can_merge:
|
||||
*
|
||||
* hbitmap_can_merge(a, b) && hbitmap_can_merge(a, result) is sufficient and
|
||||
* necessary for hbitmap_merge will not fail.
|
||||
*
|
||||
*/
|
||||
bool hbitmap_can_merge(const HBitmap *a, const HBitmap *b);
|
||||
void hbitmap_merge(const HBitmap *a, const HBitmap *b, HBitmap *result);
|
||||
|
||||
/**
|
||||
* hbitmap_empty:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue