Re: [PATCH 2/6 v3] cgroup: Implement blkio.weight tuning API.

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

 



On 02/07/2011 11:56 PM, Gui Jianfeng wrote:
> Implement blkio.weight tuning API.
> 
> Acked-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
> Signed-off-by: Gui Jianfeng <guijianfeng@xxxxxxxxxxxxxx>
> ---
>  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   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[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]