[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-stable] [Qemu-devel] [PATCH] bitmap: Update count after a merg
From: |
John Snow |
Subject: |
Re: [Qemu-stable] [Qemu-devel] [PATCH] bitmap: Update count after a merge |
Date: |
Thu, 27 Sep 2018 13:23:14 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 |
On 09/26/2018 11:11 PM, Eric Blake wrote:
> 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;
> }
>
OK, tests coming up. Thanks for the CC to stable.
--js