qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v4 10/14] nbd: Less allocation during NBD_OPT_LIST
Date: Mon, 18 Jul 2016 17:31:15 -0600	[thread overview]
Message-ID: <578D66C3.5090007@redhat.com> (raw)
In-Reply-To: <02ac5b4b-658d-018e-076f-952908f37a38@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1696 bytes --]

On 06/27/2016 06:16 AM, Paolo Bonzini wrote:
> 
> 
> On 26/06/2016 00:15, Eric Blake wrote:
>> +/* Return -1 if unrecoverable error occurs
>> , 0 if NBD_OPT_LIST is unsupported,
> 
> These two should return errp != NULL and negative errno.

Not quite.  It returns 0 if nbd_handle_reply_err() detected an
unsupported command, in which case errp is unset.  And the caller
doesn't really care what value is sent (the return value is not -errno,
merely negative).

> 
>> 1 if iteration is done
>> 2 to keep looking,
>> and 3 if * this entry matches @want. */
> 
> These three should return errp == NULL.  Please change the function so
> that the return value signifies "need another call", and a bool*
> argument is set to true if the name matches.

By that argument, you want:

old code					 new code
-1, errp set - done iterating			 -1, *match unspecified
0, unsupported - done iterating, assume match	 0, *match set
1, done iterating, match determined earlier	 0, *match unchanged
2, still iterating, this round didn't match	 1, *match unchanged
3, still iterating, this round matched		 1, *match set

where the caller starts with *match clear, iterates as long as the
result is positive, then when the result is -1 returns an error, or when
the result is 0 it returns the current setting in *match.

I can try that alternative flow, and will post an update shortly.  I
still think this is worth having in 2.7 if it is not too late (as it was
originally posted before soft freeze), but if it misses hard freeze
tomorrow, then it is 2.8 material.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2016-07-18 23:31 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-25 22:15 [Qemu-devel] [PATCH v4 00/14] nbd: efficient write zeroes Eric Blake
2016-06-25 22:15 ` [Qemu-devel] [PATCH v4 01/14] nbd: Fix bad flag detection on server Eric Blake
2016-06-25 22:15 ` [Qemu-devel] [PATCH v4 02/14] nbd: Add qemu-nbd -D for human-readable description Eric Blake
2016-06-25 22:15 ` [Qemu-devel] [PATCH v4 03/14] nbd: Limit nbdflags to 16 bits Eric Blake
2016-06-25 22:15 ` [Qemu-devel] [PATCH v4 04/14] nbd: Treat flags vs. command type as separate fields Eric Blake
2016-06-25 22:15 ` [Qemu-devel] [PATCH v4 05/14] nbd: Share common reply-sending code in server Eric Blake
2016-06-25 22:15 ` [Qemu-devel] [PATCH v4 06/14] nbd: Send message along with server NBD_REP_ERR errors Eric Blake
2016-06-27 12:02   ` Paolo Bonzini
2016-06-25 22:15 ` [Qemu-devel] [PATCH v4 07/14] nbd: Share common option-sending code in client Eric Blake
2016-06-25 22:15 ` [Qemu-devel] [PATCH v4 08/14] nbd: Let server know when client gives up negotiation Eric Blake
2016-06-25 22:15 ` [Qemu-devel] [PATCH v4 09/14] nbd: Let client skip portions of server reply Eric Blake
2016-06-25 22:15 ` [Qemu-devel] [PATCH v4 10/14] nbd: Less allocation during NBD_OPT_LIST Eric Blake
2016-06-27 12:16   ` Paolo Bonzini
2016-07-18 23:31     ` Eric Blake [this message]
2016-06-25 22:15 ` [Qemu-devel] [PATCH v4 11/14] nbd: Support shorter handshake Eric Blake
2016-06-25 22:15 ` [Qemu-devel] [PATCH v4 12/14] nbd: Improve server handling of shutdown requests Eric Blake
2016-06-25 22:15 ` [Qemu-devel] [PATCH v4 13/14] nbd: Implement NBD_CMD_WRITE_ZEROES on server Eric Blake
2016-06-25 22:15 ` [Qemu-devel] [PATCH v4 14/14] nbd: Implement NBD_CMD_WRITE_ZEROES on client Eric Blake
2016-06-27 12:13   ` Paolo Bonzini
2016-06-27 13:00     ` Eric Blake

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=578D66C3.5090007@redhat.com \
    --to=eblake@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.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 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).