Message ID | 1453270306-16608-13-git-send-email-famz@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 01/20/2016 01:11 AM, Fam Zheng wrote: > From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> > > Several functions to provide necessary access to BdrvDirtyBitmap for > block-migration.c > > Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> > [Add the "finish" parameters. - Fam] > Signed-off-by: Fam Zheng <famz@redhat.com> > --- > block/dirty-bitmap.c | 37 +++++++++++++++++++++++++++++++++++++ > include/block/dirty-bitmap.h | 14 ++++++++++++++ > 2 files changed, 51 insertions(+) > > diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c > index ec13d38..919ce10 100644 > --- a/block/dirty-bitmap.c > +++ b/block/dirty-bitmap.c > @@ -429,6 +429,43 @@ void bdrv_undo_clear_dirty_bitmap(BdrvDirtyBitmap *bitmap, HBitmap *in) > hbitmap_free(tmp); > } > > +uint64_t bdrv_dirty_bitmap_serialization_size(const BdrvDirtyBitmap *bitmap, > + uint64_t start, uint64_t count) > +{ > + return hbitmap_serialization_size(bitmap->bitmap, start, count); > +} > + > +uint64_t bdrv_dirty_bitmap_serialization_align(const BdrvDirtyBitmap *bitmap) > +{ > + return hbitmap_serialization_granularity(bitmap->bitmap); > +} > + > +void bdrv_dirty_bitmap_serialize_part(const BdrvDirtyBitmap *bitmap, > + uint8_t *buf, uint64_t start, > + uint64_t count) > +{ > + hbitmap_serialize_part(bitmap->bitmap, buf, start, count); > +} > + > +void bdrv_dirty_bitmap_deserialize_part(BdrvDirtyBitmap *bitmap, > + uint8_t *buf, uint64_t start, > + uint64_t count, bool finish) > +{ > + hbitmap_deserialize_part(bitmap->bitmap, buf, start, count, finish); > +} > + > +void bdrv_dirty_bitmap_deserialize_zeroes(BdrvDirtyBitmap *bitmap, > + uint64_t start, uint64_t count, > + bool finish) > +{ > + hbitmap_deserialize_zeroes(bitmap->bitmap, start, count, finish); > +} > + > +void bdrv_dirty_bitmap_deserialize_finish(BdrvDirtyBitmap *bitmap) > +{ > + hbitmap_deserialize_finish(bitmap->bitmap); > +} > + > void bdrv_set_dirty(BlockDriverState *bs, int64_t cur_sector, > int nr_sectors) > { > diff --git a/include/block/dirty-bitmap.h b/include/block/dirty-bitmap.h > index 8c29c3e..6ba5bec 100644 > --- a/include/block/dirty-bitmap.h > +++ b/include/block/dirty-bitmap.h > @@ -54,4 +54,18 @@ void bdrv_set_dirty_iter(BdrvDirtyBitmapIter *hbi, int64_t sector_num); > int64_t bdrv_get_dirty_count(BdrvDirtyBitmap *bitmap); > void bdrv_dirty_bitmap_truncate(BlockDriverState *bs); > > +uint64_t bdrv_dirty_bitmap_serialization_size(const BdrvDirtyBitmap *bitmap, > + uint64_t start, uint64_t count); > +uint64_t bdrv_dirty_bitmap_serialization_align(const BdrvDirtyBitmap *bitmap); > +void bdrv_dirty_bitmap_serialize_part(const BdrvDirtyBitmap *bitmap, > + uint8_t *buf, uint64_t start, > + uint64_t count); > +void bdrv_dirty_bitmap_deserialize_part(BdrvDirtyBitmap *bitmap, > + uint8_t *buf, uint64_t start, > + uint64_t count, bool finish); > +void bdrv_dirty_bitmap_deserialize_zeroes(BdrvDirtyBitmap *bitmap, > + uint64_t start, uint64_t count, > + bool finish); > +void bdrv_dirty_bitmap_deserialize_finish(BdrvDirtyBitmap *bitmap); > + > #endif > Reviewed-by: John Snow <jsnow@redhat.com>
diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c index ec13d38..919ce10 100644 --- a/block/dirty-bitmap.c +++ b/block/dirty-bitmap.c @@ -429,6 +429,43 @@ void bdrv_undo_clear_dirty_bitmap(BdrvDirtyBitmap *bitmap, HBitmap *in) hbitmap_free(tmp); } +uint64_t bdrv_dirty_bitmap_serialization_size(const BdrvDirtyBitmap *bitmap, + uint64_t start, uint64_t count) +{ + return hbitmap_serialization_size(bitmap->bitmap, start, count); +} + +uint64_t bdrv_dirty_bitmap_serialization_align(const BdrvDirtyBitmap *bitmap) +{ + return hbitmap_serialization_granularity(bitmap->bitmap); +} + +void bdrv_dirty_bitmap_serialize_part(const BdrvDirtyBitmap *bitmap, + uint8_t *buf, uint64_t start, + uint64_t count) +{ + hbitmap_serialize_part(bitmap->bitmap, buf, start, count); +} + +void bdrv_dirty_bitmap_deserialize_part(BdrvDirtyBitmap *bitmap, + uint8_t *buf, uint64_t start, + uint64_t count, bool finish) +{ + hbitmap_deserialize_part(bitmap->bitmap, buf, start, count, finish); +} + +void bdrv_dirty_bitmap_deserialize_zeroes(BdrvDirtyBitmap *bitmap, + uint64_t start, uint64_t count, + bool finish) +{ + hbitmap_deserialize_zeroes(bitmap->bitmap, start, count, finish); +} + +void bdrv_dirty_bitmap_deserialize_finish(BdrvDirtyBitmap *bitmap) +{ + hbitmap_deserialize_finish(bitmap->bitmap); +} + void bdrv_set_dirty(BlockDriverState *bs, int64_t cur_sector, int nr_sectors) { diff --git a/include/block/dirty-bitmap.h b/include/block/dirty-bitmap.h index 8c29c3e..6ba5bec 100644 --- a/include/block/dirty-bitmap.h +++ b/include/block/dirty-bitmap.h @@ -54,4 +54,18 @@ void bdrv_set_dirty_iter(BdrvDirtyBitmapIter *hbi, int64_t sector_num); int64_t bdrv_get_dirty_count(BdrvDirtyBitmap *bitmap); void bdrv_dirty_bitmap_truncate(BlockDriverState *bs); +uint64_t bdrv_dirty_bitmap_serialization_size(const BdrvDirtyBitmap *bitmap, + uint64_t start, uint64_t count); +uint64_t bdrv_dirty_bitmap_serialization_align(const BdrvDirtyBitmap *bitmap); +void bdrv_dirty_bitmap_serialize_part(const BdrvDirtyBitmap *bitmap, + uint8_t *buf, uint64_t start, + uint64_t count); +void bdrv_dirty_bitmap_deserialize_part(BdrvDirtyBitmap *bitmap, + uint8_t *buf, uint64_t start, + uint64_t count, bool finish); +void bdrv_dirty_bitmap_deserialize_zeroes(BdrvDirtyBitmap *bitmap, + uint64_t start, uint64_t count, + bool finish); +void bdrv_dirty_bitmap_deserialize_finish(BdrvDirtyBitmap *bitmap); + #endif