qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] bitmap: Update count after a merge


From: Vladimir Sementsov-Ogievskiy
Subject: Re: [Qemu-devel] [PATCH] bitmap: Update count after a merge
Date: Thu, 27 Sep 2018 11:07:09 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

27.09.2018 06:11, 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>


Reviewed-by: Vladimir Sementsov-Ogievskiy <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;
  }


--
Best regards,
Vladimir




reply via email to

[Prev in Thread] Current Thread [Next in Thread]