From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:44705) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SuNsU-0008J5-0D for qemu-devel@nongnu.org; Thu, 26 Jul 2012 09:13:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SuNsP-0004a7-Cz for qemu-devel@nongnu.org; Thu, 26 Jul 2012 09:13:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40473) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SuNsP-0004Zn-4t for qemu-devel@nongnu.org; Thu, 26 Jul 2012 09:13:13 -0400 Message-ID: <5011425E.8030201@redhat.com> Date: Thu, 26 Jul 2012 07:13:02 -0600 From: Eric Blake MIME-Version: 1.0 References: <1343048885-1701-1-git-send-email-coreyb@linux.vnet.ibm.com> <1343048885-1701-7-git-send-email-coreyb@linux.vnet.ibm.com> <500E901D.3080801@redhat.com> <500F6B04.4020508@linux.vnet.ibm.com> <500FACD6.700@redhat.com> <50104826.1040909@redhat.com> <5010B7D3.6090309@linux.vnet.ibm.com> In-Reply-To: <5010B7D3.6090309@linux.vnet.ibm.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig98E460DA059941EE1BE20A1E" Subject: Re: [Qemu-devel] [PATCH v5 6/6] block: Enable qemu_open/close to work with fd sets List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Corey Bryant Cc: Kevin Wolf , aliguori@us.ibm.com, stefanha@linux.vnet.ibm.com, libvir-list@redhat.com, qemu-devel@nongnu.org, lcapitulino@redhat.com This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig98E460DA059941EE1BE20A1E Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable On 07/25/2012 09:21 PM, Corey Bryant wrote: >=20 >=20 > On 07/25/2012 03:25 PM, Eric Blake wrote: >> On 07/25/2012 02:22 AM, Kevin Wolf wrote: >>>>> Hm, not a nice interface where qemu_close() needs the filename and >>>>> (worse) could be given a wrong filename. Maybe it would be better t= o >>>>> maintain a list of fd -> fdset mappings in qemu_open/close? >>>>> >>>> >>>> I agree, I don't really like it either. >>>> >>>> We already have a list of fd -> fdset mappings (mon_fdset_fd_t -> >>>> mon_fdset_t). Would it be too costly to loop through all the >>>> fdsets/fds >>>> at the beginning of every qemu_close()? >>> >>> I don't think so. qemu_close() is not a fast path and happens almost >>> never, and the list is short enough that searching it isn't a problem= >>> anyway. >> >> I agree - just do the loop to do the reverse lookup yourself, rather >> than making qemu_close() have a different signature than close(). >> >=20 > Great, I'll do this then. You may want an optimization of using a bitset for tracking which fds are tracked by fdset in the first place, so that the fast path of qemu_close() will be a check against the bitset to see if you even have to waste time on the reverse lookup in the first place. The bitset will typically be small (bounded not only by the maximum possible fd, but further by the fact that we don't usually open that many fds in the first place), but I'm not sure if you can get away with static sizing. --=20 Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --------------enig98E460DA059941EE1BE20A1E Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJQEUJeAAoJEKeha0olJ0Nq5CwH/iW8Kr/DMmSqBU/pQ2efskJ2 jLVyjs0/pYFON1c7NyFr3y3RViHZn1FOXYoCJcCbZXunwMCnOV4gAxxxiCTvf3vz Z+6n/kZkDWEW7jksim6obMjPyF1iJdb9wFd7EJYr5youxZwIfMeXpGNDikxERKV0 CkgFPXL5a+Q1X1hER5vd4ZZDmS0TkXoYvQV42CPNTKNpxGuOsbc/xOegKzwxKbcF K1FPQDCQqMQ7UT626zTtMp5rYQ0WQErAizlQPNyi0kE3+01dRTAwQjvLf94eRLFC IGk9O/K0iz+AymGjWr5mDUIXmLIHIYrEYWAzAGDICNyqkFzJNVQy7KJHbDZ+rcE= =B8Ej -----END PGP SIGNATURE----- --------------enig98E460DA059941EE1BE20A1E--