Loading block/dirty-bitmap.c +5 −0 Original line number Diff line number Diff line Loading @@ -725,3 +725,8 @@ BdrvDirtyBitmap *bdrv_dirty_bitmap_next(BlockDriverState *bs, return bitmap == NULL ? QLIST_FIRST(&bs->dirty_bitmaps) : QLIST_NEXT(bitmap, list); } char *bdrv_dirty_bitmap_sha256(const BdrvDirtyBitmap *bitmap, Error **errp) { return hbitmap_sha256(bitmap->bitmap, errp); } blockdev.c +25 −0 Original line number Diff line number Diff line Loading @@ -2820,6 +2820,31 @@ void qmp_block_dirty_bitmap_clear(const char *node, const char *name, bdrv_clear_dirty_bitmap(bitmap, NULL); } BlockDirtyBitmapSha256 *qmp_x_debug_block_dirty_bitmap_sha256(const char *node, const char *name, Error **errp) { BdrvDirtyBitmap *bitmap; BlockDriverState *bs; BlockDirtyBitmapSha256 *ret = NULL; char *sha256; bitmap = block_dirty_bitmap_lookup(node, name, &bs, errp); if (!bitmap || !bs) { return NULL; } sha256 = bdrv_dirty_bitmap_sha256(bitmap, errp); if (sha256 == NULL) { return NULL; } ret = g_new(BlockDirtyBitmapSha256, 1); ret->sha256 = sha256; return ret; } void hmp_drive_del(Monitor *mon, const QDict *qdict) { const char *id = qdict_get_str(qdict, "id"); Loading include/block/dirty-bitmap.h +1 −0 Original line number Diff line number Diff line Loading @@ -97,5 +97,6 @@ bool bdrv_dirty_bitmap_get_persistance(BdrvDirtyBitmap *bitmap); bool bdrv_has_changed_persistent_bitmaps(BlockDriverState *bs); BdrvDirtyBitmap *bdrv_dirty_bitmap_next(BlockDriverState *bs, BdrvDirtyBitmap *bitmap); char *bdrv_dirty_bitmap_sha256(const BdrvDirtyBitmap *bitmap, Error **errp); #endif include/qemu/hbitmap.h +8 −0 Original line number Diff line number Diff line Loading @@ -252,6 +252,14 @@ void hbitmap_deserialize_ones(HBitmap *hb, uint64_t start, uint64_t count, */ void hbitmap_deserialize_finish(HBitmap *hb); /** * hbitmap_sha256: * @bitmap: HBitmap to operate on. * * Returns SHA256 hash of the last level. */ char *hbitmap_sha256(const HBitmap *bitmap, Error **errp); /** * hbitmap_free: * @hb: HBitmap to operate on. Loading qapi/block-core.json +27 −0 Original line number Diff line number Diff line Loading @@ -1635,6 +1635,33 @@ { 'command': 'block-dirty-bitmap-clear', 'data': 'BlockDirtyBitmap' } ## # @BlockDirtyBitmapSha256: # # SHA256 hash of dirty bitmap data # # @sha256: ASCII representation of SHA256 bitmap hash # # Since: 2.10 ## { 'struct': 'BlockDirtyBitmapSha256', 'data': {'sha256': 'str'} } ## # @x-debug-block-dirty-bitmap-sha256: # # Get bitmap SHA256 # # Returns: BlockDirtyBitmapSha256 on success # If @node is not a valid block device, DeviceNotFound # If @name is not found or if hashing has failed, GenericError with an # explanation # # Since: 2.10 ## { 'command': 'x-debug-block-dirty-bitmap-sha256', 'data': 'BlockDirtyBitmap', 'returns': 'BlockDirtyBitmapSha256' } ## # @blockdev-mirror: # Loading Loading
block/dirty-bitmap.c +5 −0 Original line number Diff line number Diff line Loading @@ -725,3 +725,8 @@ BdrvDirtyBitmap *bdrv_dirty_bitmap_next(BlockDriverState *bs, return bitmap == NULL ? QLIST_FIRST(&bs->dirty_bitmaps) : QLIST_NEXT(bitmap, list); } char *bdrv_dirty_bitmap_sha256(const BdrvDirtyBitmap *bitmap, Error **errp) { return hbitmap_sha256(bitmap->bitmap, errp); }
blockdev.c +25 −0 Original line number Diff line number Diff line Loading @@ -2820,6 +2820,31 @@ void qmp_block_dirty_bitmap_clear(const char *node, const char *name, bdrv_clear_dirty_bitmap(bitmap, NULL); } BlockDirtyBitmapSha256 *qmp_x_debug_block_dirty_bitmap_sha256(const char *node, const char *name, Error **errp) { BdrvDirtyBitmap *bitmap; BlockDriverState *bs; BlockDirtyBitmapSha256 *ret = NULL; char *sha256; bitmap = block_dirty_bitmap_lookup(node, name, &bs, errp); if (!bitmap || !bs) { return NULL; } sha256 = bdrv_dirty_bitmap_sha256(bitmap, errp); if (sha256 == NULL) { return NULL; } ret = g_new(BlockDirtyBitmapSha256, 1); ret->sha256 = sha256; return ret; } void hmp_drive_del(Monitor *mon, const QDict *qdict) { const char *id = qdict_get_str(qdict, "id"); Loading
include/block/dirty-bitmap.h +1 −0 Original line number Diff line number Diff line Loading @@ -97,5 +97,6 @@ bool bdrv_dirty_bitmap_get_persistance(BdrvDirtyBitmap *bitmap); bool bdrv_has_changed_persistent_bitmaps(BlockDriverState *bs); BdrvDirtyBitmap *bdrv_dirty_bitmap_next(BlockDriverState *bs, BdrvDirtyBitmap *bitmap); char *bdrv_dirty_bitmap_sha256(const BdrvDirtyBitmap *bitmap, Error **errp); #endif
include/qemu/hbitmap.h +8 −0 Original line number Diff line number Diff line Loading @@ -252,6 +252,14 @@ void hbitmap_deserialize_ones(HBitmap *hb, uint64_t start, uint64_t count, */ void hbitmap_deserialize_finish(HBitmap *hb); /** * hbitmap_sha256: * @bitmap: HBitmap to operate on. * * Returns SHA256 hash of the last level. */ char *hbitmap_sha256(const HBitmap *bitmap, Error **errp); /** * hbitmap_free: * @hb: HBitmap to operate on. Loading
qapi/block-core.json +27 −0 Original line number Diff line number Diff line Loading @@ -1635,6 +1635,33 @@ { 'command': 'block-dirty-bitmap-clear', 'data': 'BlockDirtyBitmap' } ## # @BlockDirtyBitmapSha256: # # SHA256 hash of dirty bitmap data # # @sha256: ASCII representation of SHA256 bitmap hash # # Since: 2.10 ## { 'struct': 'BlockDirtyBitmapSha256', 'data': {'sha256': 'str'} } ## # @x-debug-block-dirty-bitmap-sha256: # # Get bitmap SHA256 # # Returns: BlockDirtyBitmapSha256 on success # If @node is not a valid block device, DeviceNotFound # If @name is not found or if hashing has failed, GenericError with an # explanation # # Since: 2.10 ## { 'command': 'x-debug-block-dirty-bitmap-sha256', 'data': 'BlockDirtyBitmap', 'returns': 'BlockDirtyBitmapSha256' } ## # @blockdev-mirror: # Loading