[libvirt] [PATCHv2 12/33] storage: Determine the local storage type right away
Peter Krempa
pkrempa at redhat.com
Mon May 26 09:12:30 UTC 2014
On 05/23/14 18:57, Eric Blake wrote:
> On 05/22/2014 07:47 AM, Peter Krempa wrote:
>> When walking the backing chain we previously set the storage type to
>> _FILE and let the virStorageFileGetMetadataFromFDInternal update it to
>> the correct type later on.
>>
>> This patch moves the actual storage type determination to the place
>> where we parse the backing store name so that the code can later be
>> switched to use virStorageFileReadHeader() directly.
>> ---
>> src/storage/storage_driver.c | 11 +++++++++++
>> 1 file changed, 11 insertions(+)
>>
>
>> @@ -3173,6 +3174,16 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src,
>> ret = 0;
>> goto cleanup;
>> }
>> +
>> + /* update the type for local storage */
>> + if (stat(backingStore->path, &st) == 0) {
>
> Does this add additional stat() calls to the loop, which could be
> optimized by including a struct stat in virStorageSource and reusing
> that data when already obtained earlier? At any rate, cleaning that up
> to minimize stat calls should be a separate patch, so this one is fine.
This indeed adds a second call to stat here, but the original call is
later removed. This call is added to satisfy the test and allow changing
some of the control flow.
>
> ACK.
>
Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140526/b918c70d/attachment-0001.sig>
More information about the libvir-list
mailing list