On 02/07/2011 11:56 PM, Gui Jianfeng wrote: > Implement blkio.weight tuning API. > > Acked-by: Daniel P. Berrange <[email protected]> > Signed-off-by: Gui Jianfeng <[email protected]> > --- > src/libvirt_private.syms | 2 ++ > src/util/cgroup.c | 39 +++++++++++++++++++++++++++++++++++++++ > src/util/cgroup.h | 3 +++ > 3 files changed, 44 insertions(+), 0 deletions(-) > > diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms > index 88e270c..490901e 100644 > --- a/src/libvirt_private.syms > +++ b/src/libvirt_private.syms > @@ -77,6 +77,8 @@ virCgroupMounted; > virCgroupRemove; > virCgroupSetCpuShares; > virCgroupSetFreezerState; > +virCgroupSetBlkioWeight; > +virCgroupGetBlkioWeight;
Not in sorted order, but that's easy enough to fix.
> +int virCgroupGetBlkioWeight(virCgroupPtr group, unsigned long *weight)
> +{
> + long long unsigned int __weight;
Use of double underscore risks collision with system headers, not to
mention it looks ugly. I'd rather s/__weight/tmp/.
> + int ret;
> + ret = virCgroupGetValueU64(group,
> + VIR_CGROUP_CONTROLLER_BLKIO,
> + "blkio.weight", &__weight);
> + if (ret == 0)
> + *weight = (unsigned long) __weight;
The cast is not strictly necessary.
ACK with this squashed in:
diff --git i/src/libvirt_private.syms w/src/libvirt_private.syms
index 490901e..1bbd44e 100644
--- i/src/libvirt_private.syms
+++ w/src/libvirt_private.syms
@@ -66,6 +66,7 @@ virCgroupDenyDevicePath;
virCgroupForDomain;
virCgroupForDriver;
virCgroupFree;
+virCgroupGetBlkioWeight;
virCgroupGetCpuShares;
virCgroupGetCpuacctUsage;
virCgroupGetFreezerState;
@@ -75,10 +76,9 @@ virCgroupGetMemoryUsage;
virCgroupGetSwapHardLimit;
virCgroupMounted;
virCgroupRemove;
+virCgroupSetBlkioWeight;
virCgroupSetCpuShares;
virCgroupSetFreezerState;
-virCgroupSetBlkioWeight;
-virCgroupGetBlkioWeight;
virCgroupSetMemory;
virCgroupSetMemoryHardLimit;
virCgroupSetMemorySoftLimit;
diff --git i/src/util/cgroup.c w/src/util/cgroup.c
index bb3f334..9cdfc6e 100644
--- i/src/util/cgroup.c
+++ w/src/util/cgroup.c
@@ -1,7 +1,7 @@
/*
* cgroup.c: Tools for managing cgroups
*
- * Copyright (C) 2010 Red Hat, Inc.
+ * Copyright (C) 2010-2011 Red Hat, Inc.
* Copyright IBM Corp. 2008
*
* See COPYING.LIB for the License of this software
@@ -879,13 +879,13 @@ int virCgroupSetBlkioWeight(virCgroupPtr group,
unsigned long weight)
*/
int virCgroupGetBlkioWeight(virCgroupPtr group, unsigned long *weight)
{
- long long unsigned int __weight;
+ long long unsigned int tmp;
int ret;
ret = virCgroupGetValueU64(group,
VIR_CGROUP_CONTROLLER_BLKIO,
- "blkio.weight", &__weight);
+ "blkio.weight", &tmp);
if (ret == 0)
- *weight = (unsigned long) __weight;
+ *weight = tmp;
return ret;
}
--
Eric Blake [email protected] +1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list [email protected] https://www.redhat.com/mailman/listinfo/libvir-list
