From d58d84539784d27c826924a79d9436178b07ff69 Mon Sep 17 00:00:00 2001 From: John Snow Date: Fri, 17 Apr 2015 19:49:58 -0400 Subject: qmp: Add support of "dirty-bitmap" sync mode for drive-backup For "dirty-bitmap" sync mode, the block job will iterate through the given dirty bitmap to decide if a sector needs backup (backup all the dirty clusters and skip clean ones), just as allocation conditions of "top" sync mode. Signed-off-by: Fam Zheng Signed-off-by: John Snow Reviewed-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi Message-id: 1429314609-29776-11-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi Signed-off-by: Kevin Wolf --- block.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'block.c') diff --git a/block.c b/block.c index dffa9dedc0..9dc5c8cb1a 100644 --- a/block.c +++ b/block.c @@ -5783,6 +5783,15 @@ static void bdrv_reset_dirty(BlockDriverState *bs, int64_t cur_sector, } } +/** + * Advance an HBitmapIter to an arbitrary offset. + */ +void bdrv_set_dirty_iter(HBitmapIter *hbi, int64_t offset) +{ + assert(hbi->hb); + hbitmap_iter_init(hbi, hbi->hb, offset); +} + int64_t bdrv_get_dirty_count(BlockDriverState *bs, BdrvDirtyBitmap *bitmap) { return hbitmap_count(bitmap->bitmap); -- cgit v1.2.3