From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44291) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPI0V-0000eZ-Jo for qemu-devel@nongnu.org; Mon, 18 Jul 2016 19:31:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bPI0U-0006GM-Fq for qemu-devel@nongnu.org; Mon, 18 Jul 2016 19:31:27 -0400 References: <1466892954-8684-1-git-send-email-eblake@redhat.com> <1466892954-8684-11-git-send-email-eblake@redhat.com> <02ac5b4b-658d-018e-076f-952908f37a38@redhat.com> From: Eric Blake Message-ID: <578D66C3.5090007@redhat.com> Date: Mon, 18 Jul 2016 17:31:15 -0600 MIME-Version: 1.0 In-Reply-To: <02ac5b4b-658d-018e-076f-952908f37a38@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="iBpOpp4HiDOkGrErUpSJx0RG6iLECb96B" Subject: Re: [Qemu-devel] [PATCH v4 10/14] nbd: Less allocation during NBD_OPT_LIST List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , qemu-devel@nongnu.org Cc: qemu-block@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --iBpOpp4HiDOkGrErUpSJx0RG6iLECb96B From: Eric Blake To: Paolo Bonzini , qemu-devel@nongnu.org Cc: qemu-block@nongnu.org Message-ID: <578D66C3.5090007@redhat.com> Subject: Re: [PATCH v4 10/14] nbd: Less allocation during NBD_OPT_LIST References: <1466892954-8684-1-git-send-email-eblake@redhat.com> <1466892954-8684-11-git-send-email-eblake@redhat.com> <02ac5b4b-658d-018e-076f-952908f37a38@redhat.com> In-Reply-To: <02ac5b4b-658d-018e-076f-952908f37a38@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 06/27/2016 06:16 AM, Paolo Bonzini wrote: >=20 >=20 > On 26/06/2016 00:15, Eric Blake wrote: >> +/* Return -1 if unrecoverable error occurs >> , 0 if NBD_OPT_LIST is unsupported, >=20 > These two should return errp !=3D 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). >=20 >> 1 if iteration is done >> 2 to keep looking, >> and 3 if * this entry matches @want. */ >=20 > These three should return errp =3D=3D 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. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --iBpOpp4HiDOkGrErUpSJx0RG6iLECb96B Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJXjWbDAAoJEKeha0olJ0NqrvEH/1G5WwZua/brVCxW3y/6oTcv UKJn1vHQ9vHDtT5agv3hH7gOsL3/KcZy0ZC9+XlIdqLMAX33Kg0vH9WR4vfoCVpl 1yCcdArySQT1PyZOeeM+X8j1eMTP8oyqUPumeFVaqhnX+3U3e1Q2zsAWX8I6GHvy 3NvNkVwLyZ2BI1hU6Y3lhxv12eDXuE91NVs0jAv6haJ9l0yPiQ2Z7XC6p6xxoGKy FN6vD/Oyp4lM5YWTvDPsdkT8GIYN9YSVDoYUMsnRy2+Z69eCUpcYHuA0G3vnJEG6 yIH1Y+cTAxzCVoZww4DdRnC22zTu7XgNHDSM+d8ktOJ+e3maEXGTIBTFApGbw7Y= =t7KE -----END PGP SIGNATURE----- --iBpOpp4HiDOkGrErUpSJx0RG6iLECb96B--