Re: [PATCHv2 13/16] storage: use cache to walk backing chain

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

 



On 10/16/2012 02:51 PM, Laine Stump wrote:
> On 10/13/2012 06:00 PM, Eric Blake wrote:
>> We used to walk the backing file chain at least twice per disk,
>> once to set up cgroup device whitelisting, and once to set up
>> security labeling.  Rather than walk the chain every iteration,
>> which possibly includes calls to fork() in order to open root-squashed
>> NFS files, we can exploit the cache of the previous patch.
> 
> Obviously creating the rule that you can't mess with the backing chain
> outside the libvirt API, but I think you've already said that :-)

Thankfully, since the cache is only kept for running qemu, and you can't
change the backing chain behind a running qemu's back except through
snapshot-create, block-pull, block-copy, or block-commit, all of which
are libvirt APIs that correctly update/invalidate the cache, we're set
(for now) :)

> 
> Whew! Can't see the code for all the deletions! :-)

Yep, this is one of those nice cleanups enabled by doing things right in
the first place.


>> +        if (disk->format > 0)
>> +            format = disk->format;
>> +        else if (ctl->allowDiskFormatProbing)
>> +            format = VIR_STORAGE_FILE_AUTO;
>> +        else
>> +            format = VIR_STORAGE_FILE_RAW;
> 
> It seems like I've seen this same bit of code a few times now...
> 
>> +
>> +        /* XXX - if we knew the qemu user:group here we could send it in
>> +         *        so that the open could be re-tried as that user:group.
>> +         */
>> +        disk->chain = virStorageFileGetMetadata(disk->src, format, -1, -1,
>> +                                                ctl->allowDiskFormatProbing,
>> +                                                NULL);
>> +

True - I'll experiment with a followup patch that moves the format
selection of the initial layer into virStorageFileGetMetadata; if it
works, expect another patch to be added in v3 (and if not, we'll just
live with the duplication).

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]