[libvirt] [PATCHv2 12/33] storage: Determine the local storage type right away

Eric Blake eblake at redhat.com
Fri May 23 16:57:29 UTC 2014


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.

ACK.

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

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


More information about the libvir-list mailing list