From 3b5d4df0c6b52746c6194bd2ea65828822db8438 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Mon, 25 Sep 2017 09:55:19 -0500 Subject: dirty-bitmap: Change bdrv_get_dirty_locked() to take bytes Half the callers were already scaling bytes to sectors; the other half can eventually be simplified to use byte iteration. Both callers were already using the result as a bool, so make that explicit. Making the change also makes it easier for a future dirty-bitmap patch to offload scaling over to the internal hbitmap. Remember, asking whether a byte is dirty is effectively asking whether the entire granularity containing the byte is dirty, since we only track dirtiness by granularity. Signed-off-by: Eric Blake Reviewed-by: John Snow Reviewed-by: Juan Quintela Reviewed-by: Kevin Wolf Reviewed-by: Fam Zheng Signed-off-by: Kevin Wolf --- migration/block.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'migration') diff --git a/migration/block.c b/migration/block.c index cbcadce168..f5bcf5505c 100644 --- a/migration/block.c +++ b/migration/block.c @@ -535,7 +535,8 @@ static int mig_save_device_dirty(QEMUFile *f, BlkMigDevState *bmds, blk_mig_unlock(); } bdrv_dirty_bitmap_lock(bmds->dirty_bitmap); - if (bdrv_get_dirty_locked(bs, bmds->dirty_bitmap, sector)) { + if (bdrv_get_dirty_locked(bs, bmds->dirty_bitmap, + sector * BDRV_SECTOR_SIZE)) { if (total_sectors - sector < BDRV_SECTORS_PER_DIRTY_CHUNK) { nr_sectors = total_sectors - sector; } else { -- cgit v1.2.3