From 06e0a9c16405c0a4c1eca33cf286cc04c42066a2 Mon Sep 17 00:00:00 2001 From: Vladimir Sementsov-Ogievskiy Date: Tue, 24 Aug 2021 11:38:41 +0300 Subject: block/copy-before-write: initialize block-copy bitmap We are going to publish copy-before-write filter to be used in separate of backup. Future step would support bitmap for the filter. But let's start from full set bitmap. We have to modify backup, as bitmap is first initialized by copy-before-write filter, and then backup modifies it. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz Message-Id: <20210824083856.17408-20-vsementsov@virtuozzo.com> Signed-off-by: Hanna Reitz --- block/copy-before-write.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'block/copy-before-write.c') diff --git a/block/copy-before-write.c b/block/copy-before-write.c index 1cefcade78..2efe098aae 100644 --- a/block/copy-before-write.c +++ b/block/copy-before-write.c @@ -147,6 +147,7 @@ static void cbw_child_perm(BlockDriverState *bs, BdrvChild *c, static int cbw_init(BlockDriverState *bs, QDict *options, Error **errp) { BDRVCopyBeforeWriteState *s = bs->opaque; + BdrvDirtyBitmap *copy_bitmap; bs->file = bdrv_open_child(NULL, options, "file", bs, &child_of_bds, BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY, @@ -174,6 +175,9 @@ static int cbw_init(BlockDriverState *bs, QDict *options, Error **errp) return -EINVAL; } + copy_bitmap = block_copy_dirty_bitmap(s->bcs); + bdrv_set_dirty_bitmap(copy_bitmap, 0, bdrv_dirty_bitmap_size(copy_bitmap)); + return 0; } -- cgit v1.2.3