All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hanna Reitz <hreitz@redhat.com>
To: Vladimir Sementsov-Ogievskiy
	<vladimir.sementsov-ogievskiy@openvz.org>,
	qemu-block@nongnu.org
Cc: kwolf@redhat.com, v.sementsov-og@mail.ru, jsnow@redhat.com,
	qemu-devel@nongnu.org, armbru@redhat.com, vsementsov@openvz.org,
	stefanha@redhat.com, eblake@redhat.com
Subject: Re: [PATCH v3 1/7] block/copy-before-write: refactor option parsing
Date: Thu, 7 Apr 2022 09:08:25 +0200	[thread overview]
Message-ID: <0c2df44a-0fcd-0989-edb3-34c848d8e098@redhat.com> (raw)
In-Reply-To: <20220406180801.374844-2-vsementsov@openvz.org>

On 06.04.22 20:07, Vladimir Sementsov-Ogievskiy wrote:
> We are going to add one more option of enum type. Let's refactor option
> parsing so that we can simply work with BlockdevOptionsCbw object.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@openvz.org>
> ---
>   block/copy-before-write.c | 55 ++++++++++++++++++++-------------------
>   1 file changed, 28 insertions(+), 27 deletions(-)
>
> diff --git a/block/copy-before-write.c b/block/copy-before-write.c
> index a8a06fdc09..6877ff893a 100644
> --- a/block/copy-before-write.c
> +++ b/block/copy-before-write.c

[...]

> @@ -376,6 +365,14 @@ static int cbw_open(BlockDriverState *bs, QDict *options, int flags,
>       BDRVCopyBeforeWriteState *s = bs->opaque;
>       BdrvDirtyBitmap *bitmap = NULL;
>       int64_t cluster_size;
> +    g_autoptr(BlockdevOptions) full_opts = NULL;
> +    BlockdevOptionsCbw *opts;
> +
> +    full_opts = cbw_parse_options(options, errp);
> +    if (!full_opts) {
> +        return -EINVAL;
> +    }
> +    opts = &full_opts->u.copy_before_write;

I would prefer an `assert(full_opts->driver == 
BLOCKDEV_DRIVER_COPY_BEFORE_WRITE);` here, but, either way:

Reviewed-by: Hanna Reitz <hreitz@redhat.com>



  reply	other threads:[~2022-04-07  7:10 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-06 18:07 [PATCH v3 0/7] copy-before-write: on-cbw-error and cbw-timeout Vladimir Sementsov-Ogievskiy
2022-04-06 18:07 ` [PATCH v3 1/7] block/copy-before-write: refactor option parsing Vladimir Sementsov-Ogievskiy
2022-04-07  7:08   ` Hanna Reitz [this message]
2022-04-06 18:07 ` [PATCH v3 2/7] block/copy-before-write: add on-cbw-error open parameter Vladimir Sementsov-Ogievskiy
2022-04-07  8:22   ` Hanna Reitz
2022-04-06 18:07 ` [PATCH v3 3/7] iotests: add copy-before-write: on-cbw-error tests Vladimir Sementsov-Ogievskiy
2022-04-06 18:07 ` [PATCH v3 4/7] util: add qemu-co-timeout Vladimir Sementsov-Ogievskiy
2022-04-07  9:20   ` Hanna Reitz
2022-04-06 18:07 ` [PATCH v3 5/7] block/block-copy: block_copy(): add timeout_ns parameter Vladimir Sementsov-Ogievskiy
2022-04-07  9:20   ` Hanna Reitz
2022-04-06 18:08 ` [PATCH v3 6/7] block/copy-before-write: implement cbw-timeout option Vladimir Sementsov-Ogievskiy
2022-04-07  9:20   ` Hanna Reitz
2022-04-06 18:08 ` [PATCH v3 7/7] iotests: copy-before-write: add cases for " Vladimir Sementsov-Ogievskiy
2022-04-07  9:19   ` Hanna Reitz
2022-04-07 10:54     ` 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=0c2df44a-0fcd-0989-edb3-34c848d8e098@redhat.com \
    --to=hreitz@redhat.com \
    --cc=armbru@redhat.com \
    --cc=eblake@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=v.sementsov-og@mail.ru \
    --cc=vladimir.sementsov-ogievskiy@openvz.org \
    --cc=vsementsov@openvz.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.