From: Eric Blake <eblake@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
qemu-block@nongnu.org
Cc: kwolf@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com
Subject: Re: [PATCH] block/backup-top: fix flags handling
Date: Fri, 31 Jan 2020 13:38:39 -0600 [thread overview]
Message-ID: <f442ed27-044e-f293-8955-74798b581ab4@redhat.com> (raw)
In-Reply-To: <20200131184805.7033-1-vsementsov@virtuozzo.com>
On 1/31/20 12:48 PM, Vladimir Sementsov-Ogievskiy wrote:
> backup-top "supports" write-unchanged, by skipping CBW operation in
> backup_top_co_pwritev. But it forgets to do the same in
> backup_top_co_pwrite_zeroes, as well as declare support for
> BDRV_REQ_WRITE_UNCHANGED.
>
> Fix this, and, while being here, declare also support for flags
> supported by source child.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
> block/backup-top.c | 28 ++++++++++++++++++----------
> 1 file changed, 18 insertions(+), 10 deletions(-)
> @@ -197,6 +201,10 @@ BlockDriverState *bdrv_backup_top_append(BlockDriverState *source,
>
> top->total_sectors = source->total_sectors;
> state = top->opaque;
> + top->supported_write_flags =
> + BDRV_REQ_WRITE_UNCHANGED | source->supported_write_flags;
> + top->supported_zero_flags =
> + BDRV_REQ_WRITE_UNCHANGED | source->supported_zero_flags;
Elsewhere, in block/filter-compress.c we do:
bs->supported_write_flags = BDRV_REQ_WRITE_UNCHANGED |
(BDRV_REQ_FUA & bs->file->bs->supported_write_flags);
bs->supported_zero_flags = BDRV_REQ_WRITE_UNCHANGED |
((BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP | BDRV_REQ_NO_FALLBACK) &
bs->file->bs->supported_zero_flags);
That's slightly more robust (if the block layer adds new BDRV_REQ_ bits,
we don't have to revisit filter-compress.c to decide if blindly exposing
those bits breaks for some reason, but rahter DO have to amend the line
to opt-in to supporting the new bits). Whereas your code does NOT need
editing if passing on the new bit is safe, but risks a subtle breakage
if we forget to filter out the new bit when passing it on would be
unsafe. I tend to lean towards safety and opt-in over blind
pass-through that works with the current set of defined bits, but not
enough to withhold:
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
next prev parent reply other threads:[~2020-01-31 19:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-31 18:48 [PATCH] block/backup-top: fix flags handling Vladimir Sementsov-Ogievskiy
2020-01-31 19:38 ` Eric Blake [this message]
2020-02-03 13:32 ` 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=f442ed27-044e-f293-8955-74798b581ab4@redhat.com \
--to=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=vsementsov@virtuozzo.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).