qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v1 01/10] qdict: implement a qdict_crumple metho


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v1 01/10] qdict: implement a qdict_crumple method for un-flattening a dict
Date: Mon, 7 Mar 2016 08:49:46 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0

On 03/07/2016 08:06 AM, Daniel P. Berrange wrote:

> So looking at the current usage of qdict_flatten,  qdict_extract_subqdict,
> qdict_array_split and qdict_array_entries, it is basically only the block
> layer.
> 
> 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 are
> 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 getting
> 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.
> 
> With this new qdict_crumple() method (or equivalently you qdict_unflatten)
> it strikes me we can significantly simplify the block layer to always use
> a nested QDict internally. All that would be required is to call the
> qdict_crumple() method in the places which have the flat QemuOpts derived
> 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
> 
> 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).

-- 
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]