[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [PATCH v4 10/14] nbd: Less allocation during NBD_OPT_LI

From: Eric Blake
Subject: Re: [Qemu-block] [PATCH v4 10/14] nbd: Less allocation during NBD_OPT_LIST
Date: Mon, 18 Jul 2016 17:31:15 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

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: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]