vircgroup: Simplify if conditions in virCgroupMakeGroup

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Pavel Hrdina 2018-08-19 11:04:52 +02:00
parent b013bdfd79
commit 0ec8416f04

View File

@ -1079,24 +1079,20 @@ virCgroupMakeGroup(virCgroupPtr parent,
goto error; goto error;
} }
} }
if (group->controllers[VIR_CGROUP_CONTROLLER_CPUSET].mountPoint != NULL && if (i == VIR_CGROUP_CONTROLLER_CPUSET &&
(i == VIR_CGROUP_CONTROLLER_CPUSET || group->controllers[i].mountPoint != NULL &&
STREQ(group->controllers[i].mountPoint, virCgroupCpuSetInherit(parent, group) < 0) {
group->controllers[VIR_CGROUP_CONTROLLER_CPUSET].mountPoint))) { goto error;
if (virCgroupCpuSetInherit(parent, group) < 0)
goto error;
} }
/* /*
* Note that virCgroupSetMemoryUseHierarchy should always be * Note that virCgroupSetMemoryUseHierarchy should always be
* called prior to creating subcgroups and attaching tasks. * called prior to creating subcgroups and attaching tasks.
*/ */
if ((flags & VIR_CGROUP_MEM_HIERACHY) && if ((flags & VIR_CGROUP_MEM_HIERACHY) &&
(group->controllers[VIR_CGROUP_CONTROLLER_MEMORY].mountPoint != NULL) && i == VIR_CGROUP_CONTROLLER_MEMORY &&
(i == VIR_CGROUP_CONTROLLER_MEMORY || group->controllers[i].mountPoint != NULL &&
STREQ(group->controllers[i].mountPoint, virCgroupSetMemoryUseHierarchy(group) < 0) {
group->controllers[VIR_CGROUP_CONTROLLER_MEMORY].mountPoint))) { goto error;
if (virCgroupSetMemoryUseHierarchy(group) < 0)
goto error;
} }
} }
} }