[libvirt] [PATCHv5 11/19] conf: Refactor code for matching existing resctrls

Wang Huaqiang huaqiang.wang at intel.com
Tue Oct 9 10:30:37 UTC 2018


Refactoring the code of matching the new resctrl with
existing resctrl groups. Add the virObjectRef action
into function virDomainResctrlVcpuMatch.

Signed-off-by: Wang Huaqiang <huaqiang.wang at intel.com>
---
 src/conf/domain_conf.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b77680e..e2b4701 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -18833,7 +18833,7 @@ virDomainResctrlVcpuMatch(virDomainDefPtr def,
          * Just updating memory allocation information of that group
          */
         if (virBitmapEqual(def->resctrls[i]->vcpus, vcpus)) {
-            *alloc = def->resctrls[i]->alloc;
+            *alloc = virObjectRef(def->resctrls[i]->alloc);
             break;
         }
         if (virBitmapOverlaps(def->resctrls[i]->vcpus, vcpus)) {
@@ -19225,8 +19225,6 @@ virDomainMemorytuneDefParse(virDomainDefPtr def,
         if (!alloc)
             goto cleanup;
         new_alloc = true;
-    } else {
-        alloc = virObjectRef(alloc);
     }
 
     for (i = 0; i < n; i++) {
-- 
2.7.4




More information about the libvir-list mailing list