
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