From: Eric Blake <eblake@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
qemu-devel@nongnu.org, qemu-block@nongnu.org
Cc: kwolf@redhat.com, pbonzini@redhat.com, den@openvz.org, mreitz@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2 3/8] nbd: BLOCK_STATUS for standard get_block_status function: server part
Date: Tue, 13 Mar 2018 08:56:14 -0500 [thread overview]
Message-ID: <3a4bef9f-30de-2805-6db8-0ac64687f373@redhat.com> (raw)
In-Reply-To: <88dd6a74-56a4-b63d-2b33-354443586331@redhat.com>
On 03/13/2018 08:47 AM, Eric Blake wrote:
> On 03/12/2018 10:21 AM, Vladimir Sementsov-Ogievskiy wrote:
>> Minimal realization: only one extent in server answer is supported.
>>
>> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
>> ---
>>
>> +/* nbd_negotiate_meta_queries
>> + * Handle NBD_OPT_LIST_META_CONTEXT and NBD_OPT_SET_META_CONTEXT
>> + *
>> + * @meta may be NULL, if caller isn't interested in selected contexts
>> (for
>> + * NBD_OPT_LIST_META_CONTEXT)
>> + *
>> + * Return -errno on I/O error, 0 if option was completely handled by
>> + * sending a reply about inconsistent lengths, or 1 on success. */
>
> Comment is wrong - this function never returns 1 (nor should it, as
> nbd_negotiate_options() expects a return of 1 only from NBD_OPT_ABORT).
>
>> +static int nbd_negotiate_meta_queries(NBDClient *client,
>> + NBDExportMetaContexts *meta,
>> Error **errp)
>> +{
>> + int ret;
>> + NBDExport *exp;
>> + NBDExportMetaContexts local_meta;
>> + uint32_t nb_queries;
>> + int i;
>> +
>> + assert(client->structured_reply);
>
> Perhaps worth a comment that this is safe because we already filtered it
> out at the caller.
>
>> +
>> + if (!meta) {
>> + meta = &local_meta;
>> + }
Or, we could check here, and even base our decision on whether to change
'meta' due to client->opt...
>> @@ -856,6 +1064,22 @@ static int nbd_negotiate_options(NBDClient
>> *client, uint16_t myflags,
>> }
>> break;
>> + case NBD_OPT_LIST_META_CONTEXT:
>> + case NBD_OPT_SET_META_CONTEXT:
>> + if (!client->structured_reply) {
>> + ret = nbd_opt_invalid(
>> + client, errp,
>> + "request option '%s' when structured reply "
>> + "is not negotiated",
>> nbd_opt_lookup(option));
>> + } else if (option == NBD_OPT_LIST_META_CONTEXT) {
>> + ret = nbd_negotiate_meta_queries(client, NULL,
>> errp);
>> + } else {
>> + ret = nbd_negotiate_meta_queries(client,
>> +
>> &client->export_meta,
>> + errp);
>> + }
Then here, we just do a single ret = nbd_negotiate_meta_queries().
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
next prev parent reply other threads:[~2018-03-13 13:56 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-12 15:21 [Qemu-devel] [PATCH v2 0/8] nbd block status base:allocation Vladimir Sementsov-Ogievskiy
2018-03-12 15:21 ` [Qemu-devel] [PATCH v2 1/8] nbd/server: add nbd_opt_invalid helper Vladimir Sementsov-Ogievskiy
2018-03-13 2:20 ` Eric Blake
2018-03-12 15:21 ` [Qemu-devel] [PATCH v2 2/8] nbd/server: add nbd_read_opt_name helper Vladimir Sementsov-Ogievskiy
2018-03-13 2:31 ` Eric Blake
2018-03-12 15:21 ` [Qemu-devel] [PATCH v2 3/8] nbd: BLOCK_STATUS for standard get_block_status function: server part Vladimir Sementsov-Ogievskiy
2018-03-13 13:47 ` Eric Blake
2018-03-13 13:56 ` Eric Blake [this message]
2018-03-12 15:21 ` [Qemu-devel] [PATCH v2 4/8] block/nbd-client: save first fatal error in nbd_iter_error Vladimir Sementsov-Ogievskiy
2018-03-12 15:21 ` [Qemu-devel] [PATCH v2 5/8] nbd: BLOCK_STATUS for standard get_block_status function: client part Vladimir Sementsov-Ogievskiy
2018-03-13 15:38 ` Eric Blake
2018-04-27 12:50 ` Peter Maydell
2018-04-27 13:22 ` Vladimir Sementsov-Ogievskiy
2018-03-12 15:21 ` [Qemu-devel] [PATCH v2 6/8] iotests.py: tiny refactor: move system imports up Vladimir Sementsov-Ogievskiy
2018-03-12 15:21 ` [Qemu-devel] [PATCH v2 7/8] iotests: add file_path helper Vladimir Sementsov-Ogievskiy
2018-03-13 15:43 ` Eric Blake
2018-03-12 15:21 ` [Qemu-devel] [PATCH v2 8/8] iotests: new test 209 for NBD BLOCK_STATUS Vladimir Sementsov-Ogievskiy
2018-03-13 15:50 ` Eric Blake
2018-03-12 15:28 ` [Qemu-devel] [PATCH v2 0/8] nbd block status base:allocation Vladimir Sementsov-Ogievskiy
2018-03-13 1:58 ` Eric Blake
2018-03-13 2:06 ` no-reply
2018-03-13 3:11 ` Eric Blake
2018-03-13 20:16 ` Eric Blake
2018-03-13 7:55 ` no-reply
2018-03-13 15:55 ` Eric Blake
2018-03-13 16:15 ` 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=3a4bef9f-30de-2805-6db8-0ac64687f373@redhat.com \
--to=eblake@redhat.com \
--cc=den@openvz.org \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=pbonzini@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).