@@ -564,3 +564,19 @@ void bdrv_finalize_persistent_dirty_bitmaps(BlockDriverState *bs)
}
}
}
+
+BdrvDirtyBitmap *bdrv_load_dirty_bitmap(BlockDriverState *bs, const char *name,
+ Error **errp)
+{
+ BlockDriver *drv = bs->drv;
+ if (!drv) {
+ return NULL;
+ }
+ if (drv->bdrv_dirty_bitmap_load) {
+ return drv->bdrv_dirty_bitmap_load(bs, name, errp);
+ }
+ if (bs->file) {
+ return bdrv_load_dirty_bitmap(bs, name, errp);
+ }
+ return NULL;
+}
@@ -84,5 +84,7 @@ void bdrv_dirty_bitmap_set_internal_persistance(BdrvDirtyBitmap *bitmap,
void bdrv_store_dirty_bitmap(BlockDriverState *bs, BdrvDirtyBitmap *bitmap,
Error **errp);
void bdrv_finalize_persistent_dirty_bitmaps(BlockDriverState *bs);
+BdrvDirtyBitmap *bdrv_load_dirty_bitmap(BlockDriverState *bs, const char *name,
+ Error **errp);
#endif
The funcion loads dirty bitmap from file, using underlying driver function. Note: the function doesn't change BdrvDirtyBitmap.file field. This field is only used by bdrv_store_dirty_bitmap() function and is ONLY written by bdrv_dirty_bitmap_set_file() function. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> --- block/dirty-bitmap.c | 16 ++++++++++++++++ include/block/dirty-bitmap.h | 2 ++ 2 files changed, 18 insertions(+)