render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
Pablo Greco 40546a
From af1714ac39a383b8a8fb0bc577fbe5e85fd8be10 Mon Sep 17 00:00:00 2001
Pablo Greco 40546a
Message-Id: <af1714ac39a383b8a8fb0bc577fbe5e85fd8be10@dist-git>
Pablo Greco 40546a
From: Pavel Hrdina <phrdina@redhat.com>
Pablo Greco 40546a
Date: Mon, 1 Jul 2019 17:06:09 +0200
Pablo Greco 40546a
Subject: [PATCH] vircgroup: Simplify if conditions in virCgroupMakeGroup
Pablo Greco 40546a
MIME-Version: 1.0
Pablo Greco 40546a
Content-Type: text/plain; charset=UTF-8
Pablo Greco 40546a
Content-Transfer-Encoding: 8bit
Pablo Greco 40546a
Pablo Greco 40546a
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Pablo Greco 40546a
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Pablo Greco 40546a
(cherry picked from commit 0ec8416f04460f3bbf7907231b28028c3daed7e7)
Pablo Greco 40546a
Pablo Greco 40546a
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1689297
Pablo Greco 40546a
Pablo Greco 40546a
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Pablo Greco 40546a
Message-Id: <b6f7814df6e28a2b68e07c0eb490bda3f340ab7c.1561993099.git.phrdina@redhat.com>
Pablo Greco 40546a
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Pablo Greco 40546a
---
Pablo Greco 40546a
 src/util/vircgroup.c | 20 ++++++++------------
Pablo Greco 40546a
 1 file changed, 8 insertions(+), 12 deletions(-)
Pablo Greco 40546a
Pablo Greco 40546a
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
Pablo Greco 40546a
index dde9ed21a2..02de33f74f 100644
Pablo Greco 40546a
--- a/src/util/vircgroup.c
Pablo Greco 40546a
+++ b/src/util/vircgroup.c
Pablo Greco 40546a
@@ -1079,24 +1079,20 @@ virCgroupMakeGroup(virCgroupPtr parent,
Pablo Greco 40546a
                     goto error;
Pablo Greco 40546a
                 }
Pablo Greco 40546a
             }
Pablo Greco 40546a
-            if (group->controllers[VIR_CGROUP_CONTROLLER_CPUSET].mountPoint != NULL &&
Pablo Greco 40546a
-                (i == VIR_CGROUP_CONTROLLER_CPUSET ||
Pablo Greco 40546a
-                 STREQ(group->controllers[i].mountPoint,
Pablo Greco 40546a
-                       group->controllers[VIR_CGROUP_CONTROLLER_CPUSET].mountPoint))) {
Pablo Greco 40546a
-                if (virCgroupCpuSetInherit(parent, group) < 0)
Pablo Greco 40546a
-                    goto error;
Pablo Greco 40546a
+            if (i == VIR_CGROUP_CONTROLLER_CPUSET &&
Pablo Greco 40546a
+                group->controllers[i].mountPoint != NULL &&
Pablo Greco 40546a
+                virCgroupCpuSetInherit(parent, group) < 0) {
Pablo Greco 40546a
+                goto error;
Pablo Greco 40546a
             }
Pablo Greco 40546a
             /*
Pablo Greco 40546a
              * Note that virCgroupSetMemoryUseHierarchy should always be
Pablo Greco 40546a
              * called prior to creating subcgroups and attaching tasks.
Pablo Greco 40546a
              */
Pablo Greco 40546a
             if ((flags & VIR_CGROUP_MEM_HIERACHY) &&
Pablo Greco 40546a
-                (group->controllers[VIR_CGROUP_CONTROLLER_MEMORY].mountPoint != NULL) &&
Pablo Greco 40546a
-                (i == VIR_CGROUP_CONTROLLER_MEMORY ||
Pablo Greco 40546a
-                 STREQ(group->controllers[i].mountPoint,
Pablo Greco 40546a
-                       group->controllers[VIR_CGROUP_CONTROLLER_MEMORY].mountPoint))) {
Pablo Greco 40546a
-                if (virCgroupSetMemoryUseHierarchy(group) < 0)
Pablo Greco 40546a
-                    goto error;
Pablo Greco 40546a
+                i == VIR_CGROUP_CONTROLLER_MEMORY &&
Pablo Greco 40546a
+                group->controllers[i].mountPoint != NULL &&
Pablo Greco 40546a
+                virCgroupSetMemoryUseHierarchy(group) < 0) {
Pablo Greco 40546a
+                goto error;
Pablo Greco 40546a
             }
Pablo Greco 40546a
         }
Pablo Greco 40546a
     }
Pablo Greco 40546a
-- 
Pablo Greco 40546a
2.22.0
Pablo Greco 40546a