[libvirt] [PATCH 14.5/16] snapshot: Make virDomainMomentObjListGetNames more generic

Eric Blake eblake at redhat.com
Fri Mar 22 17:55:45 UTC 2019


On 3/22/19 9:00 AM, John Ferlan wrote:
> 
> 
> On 3/22/19 12:25 AM, Eric Blake wrote:
>> Rather than hard-coding the snapshot filter bit values into the
>> generic code, add another layer of indirection: callers must map which
>> of their public filter bits correspond to supported moment bits, then
>> pass two separate flags (the ones translated for moment code to
>> operate on, and the remaining ones for the filter callback to operate
>> on).
>>


>> -    if (flags & VIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS) {
>> +    if (flags & VIR_DOMAIN_MOMENT_LIST_DESCENDANTS) {
>>          /* We could just always do a topological visit; but it is
>>           * possible to optimize for less stack usage and time when a
>>           * simpler full hashtable visit or counter will do. */
>>          if (from->def || (names &&
>> -                          (flags & VIR_DOMAIN_SNAPSHOT_LIST_TOPOLOGICAL)))
>> +                          (flags & VIR_DOMAIN_MOMENT_LIST_TOPOLOGICAL)))
>>              virDomainMomentForEachDescendant(from,
>>                                               virDomainMomentObjListCopyNames,
>>                                               &data);
>> -        else if (names || data.flags)
>> +        else if (names || data.flags || filter_flags)
>>              virHashForEach(moments->objs, virDomainMomentObjListCopyNames,
>>                             &data);
>>          else
> 
> Does the data.flags usage just below here calling *ForEachChild using
> *ObjListCopyNames need the "|| filter_flags" as well? Seems so with the
> call to data->filter possible.

Yes it does. Good catch, and fixed locally for when I push.

> 
> Reviewed-by: John Ferlan <jferlan at redhat.com>
> 
> John
> 
> [...]
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190322/7934b9b8/attachment-0001.sig>


More information about the libvir-list mailing list