diff options
author | Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | 2019-01-15 18:26:50 -0500 |
---|---|---|
committer | John Snow <jsnow@redhat.com> | 2019-01-15 18:26:50 -0500 |
commit | a78a1a48cd1a2e86f23f113bb05e2d3dd8ae0bf6 (patch) | |
tree | 2e2007b9051da3cdab632a4f29af3c8f1e777f3e /include | |
parent | fa9c2da29404be9baeb7b8f88fed3cb232688cd9 (diff) | |
download | qemu-a78a1a48cd1a2e86f23f113bb05e2d3dd8ae0bf6.zip qemu-a78a1a48cd1a2e86f23f113bb05e2d3dd8ae0bf6.tar.gz qemu-a78a1a48cd1a2e86f23f113bb05e2d3dd8ae0bf6.tar.bz2 |
dirty-bitmap: add bdrv_dirty_bitmap_next_dirty_area
The function alters bdrv_dirty_iter_next_area(), which is wrong and
less efficient (see further commit
"block/mirror: fix and improve do_sync_target_write" for description).
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/block/dirty-bitmap.h | 2 | ||||
-rw-r--r-- | include/qemu/hbitmap.h | 16 |
2 files changed, 18 insertions, 0 deletions
diff --git a/include/block/dirty-bitmap.h b/include/block/dirty-bitmap.h index 102ccdd..4ef00ca 100644 --- a/include/block/dirty-bitmap.h +++ b/include/block/dirty-bitmap.h @@ -101,6 +101,8 @@ BdrvDirtyBitmap *bdrv_dirty_bitmap_next(BlockDriverState *bs, char *bdrv_dirty_bitmap_sha256(const BdrvDirtyBitmap *bitmap, Error **errp); int64_t bdrv_dirty_bitmap_next_zero(BdrvDirtyBitmap *bitmap, uint64_t offset, uint64_t bytes); +bool bdrv_dirty_bitmap_next_dirty_area(BdrvDirtyBitmap *bitmap, + uint64_t *offset, uint64_t *bytes); BdrvDirtyBitmap *bdrv_reclaim_dirty_bitmap_locked(BlockDriverState *bs, BdrvDirtyBitmap *bitmap, Error **errp); diff --git a/include/qemu/hbitmap.h b/include/qemu/hbitmap.h index 1359755..097dce3 100644 --- a/include/qemu/hbitmap.h +++ b/include/qemu/hbitmap.h @@ -311,6 +311,22 @@ unsigned long hbitmap_iter_skip_words(HBitmapIter *hbi); */ int64_t hbitmap_next_zero(const HBitmap *hb, uint64_t start, uint64_t count); +/* hbitmap_next_dirty_area: + * @hb: The HBitmap to operate on + * @start: in-out parameter. + * in: the offset to start from + * out: (if area found) start of found area + * @count: in-out parameter. + * in: length of requested region + * out: length of found area + * + * If dirty area found within [@start, @start + @count), returns true and sets + * @offset and @bytes appropriately. Otherwise returns false and leaves @offset + * and @bytes unchanged. + */ +bool hbitmap_next_dirty_area(const HBitmap *hb, uint64_t *start, + uint64_t *count); + /* hbitmap_create_meta: * Create a "meta" hbitmap to track dirtiness of the bits in this HBitmap. * The caller owns the created bitmap and must call hbitmap_free_meta(hb) to |