]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: block: Don't lookup node names if they are already known
authorPeter Krempa <pkrempa@redhat.com>
Mon, 25 Sep 2017 09:39:55 +0000 (11:39 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 25 Sep 2017 12:38:15 +0000 (14:38 +0200)
Move the check that skips node name detection if they are already
present earlier so that the hash table lookup is skipped.

src/qemu/qemu_block.c

index 3437302dd15f933bc4c1b4e1efbde00896b2f26e..a3da80f88886060c8f5b03f8b75d6649c90ef1ec 100644 (file)
@@ -272,13 +272,13 @@ qemuBlockDiskDetectNodes(virDomainDiskDefPtr disk,
     qemuBlockNodeNameBackingChainDataPtr entry = NULL;
     virStorageSourcePtr src = disk->src;
 
-    if (!(entry = virHashLookup(disktable, disk->info.alias)))
-        return 0;
-
     /* don't attempt the detection if the top level already has node names */
     if (src->nodeformat || src->nodestorage)
         return 0;
 
+    if (!(entry = virHashLookup(disktable, disk->info.alias)))
+        return 0;
+
     while (src && entry) {
         if (src->nodeformat || src->nodestorage) {
             if (STRNEQ_NULLABLE(src->nodeformat, entry->nodeformat) ||