From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43680) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1acxPu-000781-3L for qemu-devel@nongnu.org; Mon, 07 Mar 2016 10:49:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1acxPq-0005xb-19 for qemu-devel@nongnu.org; Mon, 07 Mar 2016 10:49:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52545) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1acxPp-0005wq-Px for qemu-devel@nongnu.org; Mon, 07 Mar 2016 10:49:49 -0500 References: <1455900463-16007-1-git-send-email-berrange@redhat.com> <1455900463-16007-2-git-send-email-berrange@redhat.com> <56D71147.4050204@redhat.com> <20160303110135.GB32270@redhat.com> <56DAF82F.8060401@redhat.com> <20160307150629.GD13034@redhat.com> From: Eric Blake Message-ID: <56DDA31A.4010503@redhat.com> Date: Mon, 7 Mar 2016 08:49:46 -0700 MIME-Version: 1.0 In-Reply-To: <20160307150629.GD13034@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="2hQwrmrAEnDRLOCHDJBDsFAmwwifnT6PH" Subject: Re: [Qemu-devel] [PATCH v1 01/10] qdict: implement a qdict_crumple method for un-flattening a dict List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" , Max Reitz Cc: Paolo Bonzini , qemu-devel@nongnu.org, Markus Armbruster , =?UTF-8?Q?Andreas_F=c3=a4rber?= This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --2hQwrmrAEnDRLOCHDJBDsFAmwwifnT6PH Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 03/07/2016 08:06 AM, Daniel P. Berrange wrote: > So looking at the current usage of qdict_flatten, qdict_extract_subqdi= ct, > qdict_array_split and qdict_array_entries, it is basically only the blo= ck > layer. >=20 > The root cause of this usage all stems from that fact that historically= > the block layer was driven off QemuOpts CLI args which are a flat data > structure. Over time we've tried to bolt on recursive data structure > support, but the main APIs are still accepting QDicts whose contents ar= e > flat. Increasingly I see the internal code is based on QAPI which is an= > inherantly nested data structure, as a result the block layer is gettin= g > more & more places where it has to process the flat data structure to > extract nested bits (qdict_extract_subqdict, qdict_array_entries and > qdict_array_split). Conversely when fed data coming from QMP it has to > flatten the data structure with qdict_flatten. >=20 > With this new qdict_crumple() method (or equivalently you qdict_unflatt= en) > it strikes me we can significantly simplify the block layer to always u= se > a nested QDict internally. All that would be required is to call the > qdict_crumple() method in the places which have the flat QemuOpts deriv= ed > QDict. At that point we would potentially be able to delete all of > qdict_flatten, qdict_extract_subqdict, qdict_array_split and > qdict_array_entries >=20 > Of course I'm not suggesting we do that for 2.6, but it actually doesn'= t > look like it would be that hard todo this conversion. Agreed that it's too late for 2.6, but would make a good project for 2.7. For that matter, rather than passing a QDict around, I'd like to see if we could just directly use the QAPI types instead (the way you just recently converted from QDict to SocketAddress). --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --2hQwrmrAEnDRLOCHDJBDsFAmwwifnT6PH 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/ iQEcBAEBCAAGBQJW3aMaAAoJEKeha0olJ0Nqa08IAKAiTBHgbtQRkTCIja7HHyXN KJdiaAPoPIu7T4+Kw+9g91mt0CIDgrbNnVIAJNet8ACVlGV2ro4+cnuoeycGjJTA anyuNC3661jQhW53B50YKV/+aYq6Y1bMkTQM47HKAogn0qQ+k0nZNRQ8VcJi0V6u Z5vfPzIs/yKHfGHlpEdsCVRNFl4uePx8shyUrVNEe2iYPdnj/C6IpZ07qn5CWRu5 9XTAg8qEhGiVTArid2FCdCf/vMu/Ww77ZLCrG0V5w3IQOk45RT/XsGyO2LPAKn0Q QqDRGRqUHVHhQqCRhI9iYgh9Ay8ifQS5vMoBEAyBfqq7qD0K6wUVXH3wpzp8dCc= =0SJ3 -----END PGP SIGNATURE----- --2hQwrmrAEnDRLOCHDJBDsFAmwwifnT6PH--