On Fri, Dec 23, 2016 at 05:28:48PM +0300, Vladimir Sementsov-Ogievskiy wrote: > Make dirty iter resistant to resetting bits in corresponding HBitmap. > > Signed-off-by: Vladimir Sementsov-Ogievskiy <vsement...@virtuozzo.com> > --- > include/qemu/hbitmap.h | 24 ++---------------------- > util/hbitmap.c | 23 ++++++++++++++++++++++- > 2 files changed, 24 insertions(+), 23 deletions(-) > > diff --git a/include/qemu/hbitmap.h b/include/qemu/hbitmap.h > index eb46475..2873a46 100644 > --- a/include/qemu/hbitmap.h > +++ b/include/qemu/hbitmap.h > @@ -243,10 +243,7 @@ void hbitmap_free(HBitmap *hb); > * the lowest-numbered bit that is set in @hb, starting at @first. > * > * Concurrent setting of bits is acceptable, and will at worst cause the > - * iteration to miss some of those bits. Resetting bits before the current > - * position of the iterator is also okay. However, concurrent resetting of > - * bits can lead to unexpected behavior if the iterator has not yet reached > - * those bits. > + * iteration to miss some of those bits. Resetting bits is also okay. > */ > void hbitmap_iter_init(HBitmapIter *hbi, const HBitmap *hb, uint64_t first);
Do you need to modify hbitmap_iter_next_word() as well? Otherwise it uses the hbi->cur[] cached information and does not handle clearing bits ahead of the iterator. Stefan
signature.asc
Description: PGP signature