[Devel] [PATCH RHEL7 COMMIT] vziolimit: port diff-iolimit-initial-skeleton-opensource

Konstantin Khorenko khorenko at odin.com
Tue May 5 02:44:34 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-123.1.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-123.1.2.vz7.4.9
------>
commit fdb55be0a92a7b0022f68afb1dfd75a8e2220600
Author: Dmitry Monakhov <dmonakhov at openvz.org>
Date:   Tue May 5 13:44:34 2015 +0400

    vziolimit: port diff-iolimit-initial-skeleton-opensource
    
    https://jira.sw.ru/browse/PSBM-20104
    
    Signed-off-by: Dmitry Monakhov <dmonakhov at openvz.org>
---
 include/linux/vziolimit.h | 17 +++++++++++++++
 kernel/Kconfig.openvz     |  8 +++++++
 kernel/ve/Makefile        |  2 ++
 kernel/ve/vziolimit.c     | 53 +++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 80 insertions(+)

diff --git a/include/linux/vziolimit.h b/include/linux/vziolimit.h
new file mode 100644
index 0000000..a017b0f
--- /dev/null
+++ b/include/linux/vziolimit.h
@@ -0,0 +1,17 @@
+/*
+ *  include/linux/vziolimit.h
+ *
+ *  Copyright (C) 2010, Parallels inc.
+ *  All rights reserved.
+ *
+ */
+
+#ifndef _LINUX_VZIOLIMIT_H
+#define _LINUX_VZIOLIMIT_H
+
+#include <linux/types.h>
+#include <linux/ioctl.h>
+
+#define VZIOLIMITTYPE 'I'
+
+#endif /* _LINUX_VZIOLIMIT_H */
diff --git a/kernel/Kconfig.openvz b/kernel/Kconfig.openvz
index 3eb2fd2..5b6e6c1 100644
--- a/kernel/Kconfig.openvz
+++ b/kernel/Kconfig.openvz
@@ -108,3 +108,11 @@ config VTTYS
 	default y
 
 endmenu
+
+
+config VZ_IOLIMIT
+	tristate "Container IO-limiting"
+	depends on VE && VE_CALLS && BC_IO_ACCOUNTING
+	default m
+	help
+	   This option provides io-limiting module.
diff --git a/kernel/ve/Makefile b/kernel/ve/Makefile
index cd798ad..a8371d5 100644
--- a/kernel/ve/Makefile
+++ b/kernel/ve/Makefile
@@ -18,6 +18,8 @@ obj-$(CONFIG_VE_NETDEV_ACCOUNTING) += vznetstat/vznetstat.o vznetstat/ip_vznetst
 obj-$(CONFIG_VZ_LIST) += vzlist.o
 obj-$(CONFIG_VE_CALLS) += vzstat.o
 
+obj-$(CONFIG_VZ_IOLIMIT) += vziolimit.o
+
 obj-m += dummy/ip6_vzprivnet.o
 obj-m += dummy/ip_vzprivnet.o
 obj-m += dummy/pio_nfs.o
diff --git a/kernel/ve/vziolimit.c b/kernel/ve/vziolimit.c
new file mode 100644
index 0000000..d8edb1e
--- /dev/null
+++ b/kernel/ve/vziolimit.c
@@ -0,0 +1,53 @@
+/*
+ *  kernel/ve/vziolimit.c
+ *
+ *  Copyright (C) 2010, Parallels inc.
+ *  All rights reserved.
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/sched.h>
+#include <linux/virtinfo.h>
+#include <linux/vzctl.h>
+#include <linux/vziolimit.h>
+#include <bc/beancounter.h>
+
+static int iolimit_virtinfo(struct vnotifier_block *nb,
+		unsigned long cmd, void *arg, int old_ret)
+{
+}
+
+static struct vnotifier_block iolimit_virtinfo_nb = {
+	.notifier_call = iolimit_virtinfo,
+};
+
+static int iolimit_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+{
+}
+
+static struct vzioctlinfo iolimit_vzioctl = {
+	.type		= VZIOLIMITTYPE,
+	.ioctl		= iolimit_ioctl,
+#ifdef CONFIG_COMPAT
+	.compat_ioctl	= iolimit_ioctl,
+#endif
+	.owner		= THIS_MODULE,
+};
+
+static int __init iolimit_init(void)
+{
+	virtinfo_notifier_register(VITYPE_IO, &iolimit_virtinfo_nb);
+	vzioctl_register(&iolimit_vzioctl);
+
+	return 0;
+}
+
+static void __exit iolimit_exit(void)
+{
+	vzioctl_unregister(&iolimit_vzioctl);
+	virtinfo_notifier_unregister(VITYPE_IO, &iolimit_virtinfo_nb);
+}
+
+module_init(iolimit_init)
+module_exit(iolimit_exit)



More information about the Devel mailing list