From: Eric Blake <eblake@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
qemu-devel@nongnu.org
Cc: kwolf@redhat.com, qemu-block@nongnu.org, pkrempa@redhat.com,
rjones@redhat.com, stefanha@redhat.com
Subject: Re: [PATCH v2 3/5] nbd: Simplify meta-context parsing
Date: Wed, 7 Oct 2020 16:28:29 -0500 [thread overview]
Message-ID: <ca1c9ca4-fb5d-dcff-e0d1-4fa7a3580057@redhat.com> (raw)
In-Reply-To: <9a8a379a-0f43-017c-113a-a355ff9ec5df@virtuozzo.com>
[-- Attachment #1.1: Type: text/plain, Size: 2209 bytes --]
On 10/7/20 6:51 AM, Vladimir Sementsov-Ogievskiy wrote:
> 30.09.2020 15:11, Eric Blake wrote:
>> We had a premature optimization of trying to read as little from the
>> wire as possible while handling NBD_OPT_SET_META_CONTEXT in phases.
>> But in reality, we HAVE to read the entire string from the client
>> before we can get to the next command, and it is easier to just read
>> it all at once than it is to read it in pieces. And once we do that,
>> several functions end up no longer performing I/O, so they can drop
>> length and errp parameters, and just return a bool instead of
>> modifying through a pointer.
>>
>> Our iotests still pass; I also checked that libnbd's testsuite (which
>> covers more corner cases of odd meta context requests) still passes.
>>
>
> Also, do not advertise bitmaps meta context when bitmap export is not set.
That was already there, although seeing the logic change is tricky and
the trace messages change:
> +static bool nbd_meta_qemu_query(NBDClient *client, NBDExportMetaContexts *meta,
> + const char *query)
> {
> - bool dirty_bitmap = false;
> - size_t dirty_bitmap_len = strlen("dirty-bitmap:");
> - int ret;
> -
> - if (!meta->exp->export_bitmap) {
> - trace_nbd_negotiate_meta_query_skip("no dirty-bitmap exported");
> - return nbd_opt_skip(client, len, errp);
Old code returned early if there was no bitmap export set
> + if (!nbd_strshift(&query, "qemu:")) {
> + return false;
> }
> + trace_nbd_negotiate_meta_query_parse("qemu:");
>
> - if (len == 0) {
> + if (!*query) {
> if (client->opt == NBD_OPT_LIST_META_CONTEXT) {
> + meta->bitmap = !!meta->exp->export_bitmap;
while the new code has to handle it specifically. I'll tweak the commit
message to mention the change in trace messages, even when the end
behavior is the same.
>
>> Signed-off-by: Eric Blake <eblake@redhat.com>
>
> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2020-10-07 21:29 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-30 12:11 [PATCH v2 0/5] Exposing backing-chain allocation over NBD Eric Blake
2020-09-30 12:11 ` [PATCH v2 1/5] qemu-nbd: Honor SIGINT and SIGHUP Eric Blake
2020-10-07 10:32 ` Vladimir Sementsov-Ogievskiy
2020-10-07 21:13 ` Eric Blake
2020-10-08 8:27 ` Vladimir Sementsov-Ogievskiy
2020-09-30 12:11 ` [PATCH v2 2/5] nbd/server: Reject embedded NUL in NBD strings Eric Blake
2020-10-07 10:39 ` Vladimir Sementsov-Ogievskiy
2020-09-30 12:11 ` [PATCH v2 3/5] nbd: Simplify meta-context parsing Eric Blake
2020-10-07 11:51 ` Vladimir Sementsov-Ogievskiy
2020-10-07 21:28 ` Eric Blake [this message]
2020-09-30 12:11 ` [PATCH v2 4/5] nbd: Add new qemu:allocation-depth metacontext Eric Blake
2020-10-07 13:40 ` Vladimir Sementsov-Ogievskiy
2020-10-07 21:54 ` Eric Blake
2020-10-08 13:04 ` Vladimir Sementsov-Ogievskiy
2020-09-30 12:11 ` [PATCH v2 5/5] nbd: Add 'qemu-nbd -A' to expose allocation depth Eric Blake
2020-10-07 14:03 ` 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=ca1c9ca4-fb5d-dcff-e0d1-4fa7a3580057@redhat.com \
--to=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=pkrempa@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=rjones@redhat.com \
--cc=stefanha@redhat.com \
--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).