On 15.07.2016 22:27, John Snow wrote: > From: Fam Zheng <f...@redhat.com> > > The added group of operations enables tracking of the changed bits in > the dirty bitmap. > > Signed-off-by: Fam Zheng <f...@redhat.com> > Reviewed-by: Max Reitz <mre...@redhat.com> > Signed-off-by: John Snow <js...@redhat.com> > --- > block/dirty-bitmap.c | 52 > ++++++++++++++++++++++++++++++++++++++++++++ > include/block/dirty-bitmap.h | 9 ++++++++ > 2 files changed, 61 insertions(+) > > diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c > index 628b77c..9c53c56 100644 > --- a/block/dirty-bitmap.c > +++ b/block/dirty-bitmap.c > @@ -38,6 +38,7 @@
[...] > +int bdrv_dirty_bitmap_get_meta(BlockDriverState *bs, > + BdrvDirtyBitmap *bitmap, int64_t sector, > + int nb_sectors) > +{ > + uint64_t i; > + int gran = bdrv_dirty_bitmap_granularity(bitmap) >> BDRV_SECTOR_BITS; > + > + /* To optimize: we can make hbitmap to internally check the range in a > + * coarse level, or at least do it word by word. */ So you really want to leave even the simple optimizations for later? :-) (i.e. "int gran = hbitmap_granularity(bitmap->meta);") Max > + for (i = sector; i < sector + nb_sectors; i += gran) { > + if (hbitmap_get(bitmap->meta, i)) { > + return true; > + } > + } > + return false; > +}
signature.asc
Description: OpenPGP digital signature