From: Hanna Reitz <hreitz@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
qemu-block@nongnu.org
Cc: kwolf@redhat.com, wencongyang2@huawei.com,
xiechanglong.d@gmail.com, qemu-devel@nongnu.org,
armbru@redhat.com, jsnow@redhat.com,
nikita.lapshin@virtuozzo.com, eblake@redhat.com
Subject: Re: [PATCH v3 03/19] block/block-copy: block_copy_state_new(): add bitmap parameter
Date: Fri, 14 Jan 2022 17:58:52 +0100 [thread overview]
Message-ID: <f891b117-aa35-e660-15b5-2cf8ab7a8d3d@redhat.com> (raw)
In-Reply-To: <20211222174018.257550-4-vsementsov@virtuozzo.com>
On 22.12.21 18:40, Vladimir Sementsov-Ogievskiy wrote:
> This will be used in the following commit to bring "incremental" mode
> to copy-before-write filter.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
> include/block/block-copy.h | 2 +-
> block/block-copy.c | 14 ++++++++++++--
> block/copy-before-write.c | 2 +-
> 3 files changed, 14 insertions(+), 4 deletions(-)
>
> diff --git a/include/block/block-copy.h b/include/block/block-copy.h
> index 99370fa38b..8da4cec1b6 100644
> --- a/include/block/block-copy.h
> +++ b/include/block/block-copy.h
> @@ -25,7 +25,7 @@ typedef struct BlockCopyState BlockCopyState;
> typedef struct BlockCopyCallState BlockCopyCallState;
>
> BlockCopyState *block_copy_state_new(BdrvChild *source, BdrvChild *target,
> - Error **errp);
> + BdrvDirtyBitmap *bitmap, Error **errp);
>
> /* Function should be called prior any actual copy request */
> void block_copy_set_copy_opts(BlockCopyState *s, bool use_copy_range,
> diff --git a/block/block-copy.c b/block/block-copy.c
> index abda7a80bd..f6345e3a4c 100644
> --- a/block/block-copy.c
> +++ b/block/block-copy.c
> @@ -384,8 +384,9 @@ static int64_t block_copy_calculate_cluster_size(BlockDriverState *target,
> }
>
> BlockCopyState *block_copy_state_new(BdrvChild *source, BdrvChild *target,
> - Error **errp)
> + BdrvDirtyBitmap *bitmap, Error **errp)
Could be `const` to signal that we won’t be using this bitmap for the
BCS, but given our inconsistent usage of `const`, it isn’t anything
that’d be important.
> {
> + ERRP_GUARD();
> BlockCopyState *s;
> int64_t cluster_size;
> BdrvDirtyBitmap *copy_bitmap;
> @@ -402,7 +403,16 @@ BlockCopyState *block_copy_state_new(BdrvChild *source, BdrvChild *target,
> return NULL;
> }
> bdrv_disable_dirty_bitmap(copy_bitmap);
> - bdrv_set_dirty_bitmap(copy_bitmap, 0, bdrv_dirty_bitmap_size(copy_bitmap));
> + if (bitmap) {
> + if (!bdrv_merge_dirty_bitmap(copy_bitmap, bitmap, NULL, errp)) {
> + error_prepend(errp, "Failed to merge bitmap '%s' to internal "
> + "copy-bitmap: ", bdrv_dirty_bitmap_name(bitmap));
> + return NULL;
What might be Should we free `copy_bitmap` here?
(Apart from this, looks good to me!)
> + }
> + } else {
> + bdrv_set_dirty_bitmap(copy_bitmap, 0,
> + bdrv_dirty_bitmap_size(copy_bitmap));
> + }
>
> /*
> * If source is in backing chain of target assume that target is going to be
> diff --git a/block/copy-before-write.c b/block/copy-before-write.c
> index 5bdaf0a9d9..799223e3fb 100644
> --- a/block/copy-before-write.c
> +++ b/block/copy-before-write.c
> @@ -170,7 +170,7 @@ static int cbw_open(BlockDriverState *bs, QDict *options, int flags,
> ((BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP | BDRV_REQ_NO_FALLBACK) &
> bs->file->bs->supported_zero_flags);
>
> - s->bcs = block_copy_state_new(bs->file, s->target, errp);
> + s->bcs = block_copy_state_new(bs->file, s->target, NULL, errp);
> if (!s->bcs) {
> error_prepend(errp, "Cannot create block-copy-state: ");
> return -EINVAL;
next prev parent reply other threads:[~2022-01-14 17:06 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-22 17:39 [PATCH v3 00/19] Make image fleecing more usable Vladimir Sementsov-Ogievskiy
2021-12-22 17:40 ` [PATCH v3 01/19] block/block-copy: move copy_bitmap initialization to block_copy_state_new() Vladimir Sementsov-Ogievskiy
2022-01-14 16:54 ` Hanna Reitz
2021-12-22 17:40 ` [PATCH v3 02/19] block/dirty-bitmap: bdrv_merge_dirty_bitmap(): add return value Vladimir Sementsov-Ogievskiy
2022-01-14 16:55 ` Hanna Reitz
2021-12-22 17:40 ` [PATCH v3 03/19] block/block-copy: block_copy_state_new(): add bitmap parameter Vladimir Sementsov-Ogievskiy
2022-01-14 16:58 ` Hanna Reitz [this message]
2021-12-22 17:40 ` [PATCH v3 04/19] block/copy-before-write: add bitmap open parameter Vladimir Sementsov-Ogievskiy
2022-01-14 17:47 ` Hanna Reitz
2022-01-17 11:36 ` Vladimir Sementsov-Ogievskiy
2021-12-22 17:40 ` [PATCH v3 05/19] block/block-copy: add block_copy_reset() Vladimir Sementsov-Ogievskiy
2022-01-14 17:51 ` Hanna Reitz
2021-12-22 17:40 ` [PATCH v3 06/19] block: intoduce reqlist Vladimir Sementsov-Ogievskiy
2022-01-14 18:20 ` Hanna Reitz
2021-12-22 17:40 ` [PATCH v3 07/19] block/dirty-bitmap: introduce bdrv_dirty_bitmap_status() Vladimir Sementsov-Ogievskiy
2022-01-17 10:06 ` Nikta Lapshin
2022-01-17 12:02 ` Vladimir Sementsov-Ogievskiy
2022-01-18 13:31 ` Hanna Reitz
2022-01-26 10:56 ` Vladimir Sementsov-Ogievskiy
2021-12-22 17:40 ` [PATCH v3 08/19] block/reqlist: add reqlist_wait_all() Vladimir Sementsov-Ogievskiy
2022-01-17 12:34 ` Nikta Lapshin
2022-01-18 13:44 ` Hanna Reitz
2021-12-22 17:40 ` [PATCH v3 09/19] block: introduce FleecingState class Vladimir Sementsov-Ogievskiy
2022-01-18 16:37 ` Hanna Reitz
2022-01-18 18:35 ` Vladimir Sementsov-Ogievskiy
2021-12-22 17:40 ` [PATCH v3 10/19] block: introduce fleecing block driver Vladimir Sementsov-Ogievskiy
2022-01-20 16:11 ` Hanna Reitz
2022-01-21 10:46 ` Vladimir Sementsov-Ogievskiy
2022-01-27 15:28 ` Vladimir Sementsov-Ogievskiy
2021-12-22 17:40 ` [PATCH v3 11/19] block/copy-before-write: support " Vladimir Sementsov-Ogievskiy
2021-12-22 17:40 ` [PATCH v3 12/19] block/block-copy: add write-unchanged mode Vladimir Sementsov-Ogievskiy
2021-12-22 17:40 ` [PATCH v3 13/19] block/copy-before-write: use write-unchanged in fleecing mode Vladimir Sementsov-Ogievskiy
2021-12-22 17:40 ` [PATCH v3 14/19] iotests/image-fleecing: add test-case for fleecing format node Vladimir Sementsov-Ogievskiy
2021-12-22 17:40 ` [PATCH v3 15/19] iotests.py: add qemu_io_pipe_and_status() Vladimir Sementsov-Ogievskiy
2021-12-22 17:40 ` [PATCH v3 16/19] iotests/image-fleecing: add test case with bitmap Vladimir Sementsov-Ogievskiy
2021-12-22 17:40 ` [PATCH v3 17/19] block: blk_root(): return non-const pointer Vladimir Sementsov-Ogievskiy
2021-12-22 17:40 ` [PATCH v3 18/19] qapi: backup: add immutable-source parameter Vladimir Sementsov-Ogievskiy
2021-12-22 17:40 ` [PATCH v3 19/19] iotests/image-fleecing: test push backup with fleecing Vladimir Sementsov-Ogievskiy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f891b117-aa35-e660-15b5-2cf8ab7a8d3d@redhat.com \
--to=hreitz@redhat.com \
--cc=armbru@redhat.com \
--cc=eblake@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=nikita.lapshin@virtuozzo.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=vsementsov@virtuozzo.com \
--cc=wencongyang2@huawei.com \
--cc=xiechanglong.d@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).