From 76d570dc495c56bbdcc4574bfc6d512dcb8e9aa9 Mon Sep 17 00:00:00 2001 From: Vladimir Sementsov-Ogievskiy Date: Tue, 15 Jan 2019 18:26:49 -0500 Subject: dirty-bitmap: improve bdrv_dirty_bitmap_next_zero Add bytes parameter to the function, to limit searched range. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block/backup.c | 3 ++- block/dirty-bitmap.c | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'block') diff --git a/block/backup.c b/block/backup.c index b829b251eb..9ffce5c183 100644 --- a/block/backup.c +++ b/block/backup.c @@ -422,7 +422,8 @@ static void backup_incremental_init_copy_bitmap(BackupBlockJob *job) break; } - offset = bdrv_dirty_bitmap_next_zero(job->sync_bitmap, offset); + offset = bdrv_dirty_bitmap_next_zero(job->sync_bitmap, offset, + UINT64_MAX); if (offset == -1) { hbitmap_set(job->copy_bitmap, cluster, end - cluster); break; diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c index 6b688394e4..b162f4ac22 100644 --- a/block/dirty-bitmap.c +++ b/block/dirty-bitmap.c @@ -781,9 +781,10 @@ char *bdrv_dirty_bitmap_sha256(const BdrvDirtyBitmap *bitmap, Error **errp) return hbitmap_sha256(bitmap->bitmap, errp); } -int64_t bdrv_dirty_bitmap_next_zero(BdrvDirtyBitmap *bitmap, uint64_t offset) +int64_t bdrv_dirty_bitmap_next_zero(BdrvDirtyBitmap *bitmap, uint64_t offset, + uint64_t bytes) { - return hbitmap_next_zero(bitmap->bitmap, offset); + return hbitmap_next_zero(bitmap->bitmap, offset, bytes); } void bdrv_merge_dirty_bitmap(BdrvDirtyBitmap *dest, const BdrvDirtyBitmap *src, -- cgit v1.2.3