Previously a BlockDriverState has only one dirty bitmap (bs->dirty_bitmap), consequently only one caller can keep track of writings with it. This limit is removed by this series. This is useful for implementing features like incremental backup, which may require multiple dirty bitmap callers for one BDS.
The bs->dirty_bitmap is changed to QLIST of HBitmap as bs->dirty_bitmaps, while still maintained by block.c. The caller calls bdrv_create_dirty_bitmap() to allocate a dirty bitmap and releases it after use by bdrv_release_dirty_bitmap(). Block.c automatically sets dirty bits just like existing code, but to all the dirty bitmaps in the BDS. That way the caller doesn't need to register a callback and update dirty bit explicitly. Fam Zheng (3): HBitmap: move struct HBitmap to header HBitmap: add QLIST_ENTRY to HBitmap block: per caller dirty bitmap block-migration.c | 22 ++++++++++---- block.c | 74 ++++++++++++++++++++++++++--------------------- block/mirror.c | 23 ++++++++------- block/qapi.c | 8 ----- include/block/block.h | 11 ++++--- include/block/block_int.h | 2 +- include/qemu/hbitmap.h | 42 +++++++++++++++++++++++++++ util/hbitmap.c | 38 ------------------------ 8 files changed, 120 insertions(+), 100 deletions(-) -- 1.8.3.1