This members represents fs.aio-(max)-nr sysctl entries.
While fs.aio-max-nr can be adjusted from inside of ve with
traditional sysctl utility the @aio-nr is read only so we
need an interface for its c/r.

Moreover I think being able to c/r from libvzctl script is
better in terms of keeping c/r work in one place, so instead
of handling fs.aio-max-nr with sysctl utility from inside of ve
context, I do it via scripts and for this sake fs.aio-max-nr
is exported via cgroup api.

https://jira.sw.ru/browse/PSBM-40690

Signed-off-by: Cyrill Gorcunov <[email protected]>
CC: Vladimir Davydov <[email protected]>
CC: Konstantin Khorenko <[email protected]>
---
 kernel/ve/ve.c |   29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)

Index: linux-pcs7.git/kernel/ve/ve.c
===================================================================
--- linux-pcs7.git.orig/kernel/ve/ve.c
+++ linux-pcs7.git/kernel/ve/ve.c
@@ -1180,7 +1180,9 @@ enum {
        VE_CF_IPTABLES_MASK,
        VE_CF_PSEUDOSUPER,
        VE_CF_CLOCK_MONOTONIC,
-       VE_CF_CLOCK_BOOTBASED
+       VE_CF_CLOCK_BOOTBASED,
+       VE_CF_AIO_NR,
+       VE_CF_AIO_MAX_NR,
 };
 
 static int ve_ts_read(struct cgroup *cg, struct cftype *cft, struct seq_file 
*m)
@@ -1240,6 +1242,10 @@ static u64 ve_read_u64(struct cgroup *cg
 #endif
        else if (cft->private == VE_CF_PSEUDOSUPER)
                return cgroup_ve(cg)->is_pseudosuper;
+       else if (cft->private == VE_CF_AIO_NR)
+               return cgroup_ve(cg)->aio_nr;
+       else if (cft->private == VE_CF_AIO_MAX_NR)
+               return cgroup_ve(cg)->aio_max_nr;
        return 0;
 }
 
@@ -1276,7 +1282,8 @@ static int ve_write_u64(struct cgroup *c
 {
        struct ve_struct *ve = cgroup_ve(cg);
 
-       if (!ve_is_super(get_exec_env()))
+       if (!ve_is_super(get_exec_env()) &&
+           !ve->is_pseudosuper)
                return -EPERM;
 
        down_write(&ve->op_sem);
@@ -1291,6 +1298,10 @@ static int ve_write_u64(struct cgroup *c
        else if (cft->private == VE_CF_IPTABLES_MASK)
                ve->ipt_mask = ve_setup_iptables_mask(value);
 #endif
+       else if (cft->private == VE_CF_AIO_NR)
+               ve->aio_nr = value;
+       else if (cft->private == VE_CF_AIO_MAX_NR)
+               ve->aio_max_nr = value;
        up_write(&ve->op_sem);
        return 0;
 }
@@ -1359,6 +1370,20 @@ static struct cftype ve_cftypes[] = {
                .write_string           = ve_ts_write,
                .private                = VE_CF_CLOCK_BOOTBASED,
        },
+       {
+               .name                   = "aio_nr",
+               .flags                  = CFTYPE_NOT_ON_ROOT,
+               .read_u64               = ve_read_u64,
+               .write_u64              = ve_write_u64,
+               .private                = VE_CF_AIO_NR,
+       },
+       {
+               .name                   = "aio_max_nr",
+               .flags                  = CFTYPE_NOT_ON_ROOT,
+               .read_u64               = ve_read_u64,
+               .write_u64              = ve_write_u64,
+               .private                = VE_CF_AIO_MAX_NR,
+       },
        { }
 };
 
_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to