[PATCH 33/36] virLXCControllerSetup(Resource|Cgroup)Limits: Refactor cleanup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Remove the pointless cleanup sections.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/lxc/lxc_controller.c | 26 ++++++++++----------------
 1 file changed, 10 insertions(+), 16 deletions(-)

diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index ae1f090077..c577d6a427 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -808,7 +808,6 @@ static int virLXCControllerGetNumadAdvice(virLXCController *ctrl,
 static int virLXCControllerSetupResourceLimits(virLXCController *ctrl)
 {
     g_autoptr(virBitmap) auto_nodeset = NULL;
-    int ret = -1;
     virBitmap *nodeset = NULL;
     virDomainNumatuneMemMode mode;

@@ -824,21 +823,19 @@ static int virLXCControllerSetupResourceLimits(virLXCController *ctrl)
             VIR_DEBUG("Setting up process resource limits");

             if (virLXCControllerGetNumadAdvice(ctrl, &auto_nodeset) < 0)
-                goto cleanup;
+                return -1;

             nodeset = virDomainNumatuneGetNodeset(ctrl->def->numa, auto_nodeset, -1);

             if (virNumaSetupMemoryPolicy(mode, nodeset) < 0)
-                goto cleanup;
+                return -1;
         }
     }

     if (virLXCControllerSetupCpuAffinity(ctrl) < 0)
-        goto cleanup;
+        return -1;

-    ret = 0;
- cleanup:
-    return ret;
+    return 0;
 }


@@ -849,14 +846,13 @@ static int virLXCControllerSetupResourceLimits(virLXCController *ctrl)
 static int virLXCControllerSetupCgroupLimits(virLXCController *ctrl)
 {
     g_autoptr(virBitmap) auto_nodeset = NULL;
-    int ret = -1;
     virBitmap *nodeset = NULL;
     size_t i;

     VIR_DEBUG("Setting up cgroup resource limits");

     if (virLXCControllerGetNumadAdvice(ctrl, &auto_nodeset) < 0)
-        goto cleanup;
+        return -1;

     nodeset = virDomainNumatuneGetNodeset(ctrl->def->numa, auto_nodeset, -1);

@@ -864,23 +860,21 @@ static int virLXCControllerSetupCgroupLimits(virLXCController *ctrl)
                                             getpid(),
                                             ctrl->nnicindexes,
                                             ctrl->nicindexes)))
-        goto cleanup;
+        return -1;

     if (virCgroupAddMachineProcess(ctrl->cgroup, ctrl->initpid) < 0)
-        goto cleanup;
+        return -1;

     /* Add all qemu-nbd tasks to the cgroup */
     for (i = 0; i < ctrl->nnbdpids; i++) {
         if (virCgroupAddMachineProcess(ctrl->cgroup, ctrl->nbdpids[i]) < 0)
-            goto cleanup;
+            return -1;
     }

     if (virLXCCgroupSetup(ctrl->def, ctrl->cgroup, nodeset) < 0)
-        goto cleanup;
+        return -1;

-    ret = 0;
- cleanup:
-    return ret;
+    return 0;
 }


-- 
2.31.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux