Signed-off-by: Vladimir Davydov <vdavy...@parallels.com>
---
 block/cfq-iosched.c |  7 +++++++
 kernel/bc/io_prio.c | 19 +++++++++----------
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index c649678cf800..b4a9ff76fe39 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1739,6 +1739,13 @@ static int cfq_set_leaf_weight(struct cgroup *cgrp, 
struct cftype *cft, u64 val)
        return __cfq_set_weight(cgrp, cft, val, true);
 }
 
+#ifdef CONFIG_BC_IO_PRIORITY
+int blkcg_set_weight(struct cgroup *cgrp, unsigned int weight)
+{
+       return cfq_set_weight(cgrp, NULL, weight);
+}
+#endif
+
 static int cfqg_print_stat(struct cgroup *cgrp, struct cftype *cft,
                           struct seq_file *sf)
 {
diff --git a/kernel/bc/io_prio.c b/kernel/bc/io_prio.c
index f51553c236cc..6d31ce9c17e5 100644
--- a/kernel/bc/io_prio.c
+++ b/kernel/bc/io_prio.c
@@ -14,11 +14,16 @@
 #include <bc/proc.h>
 #include "blk-cgroup.h"
 
-//static u64 ioprio_weight[UB_IOPRIO_MAX] = {320, 365, 410, 460, 500, 550, 
600, 640};
+static unsigned int ioprio_weight[UB_IOPRIO_MAX] = {
+       320, 365, 410, 460, 500, 550, 600, 640,
+};
+
+extern int blkcg_set_weight(struct cgroup *cgrp, unsigned int weight);
 
 int ub_set_ioprio(int id, int ioprio)
 {
        struct user_beancounter *ub;
+       struct cgroup_subsys_state *css;
        int ret;
 
        ret = -ERANGE;
@@ -30,15 +35,9 @@ int ub_set_ioprio(int id, int ioprio)
        if (!ub)
                goto out;
 
-       ret = 0;
-#if 0
-       if (ub->blkio_cgroup)
-//             ret = blkio_cgroup_set_weight(ub->blkio_cgroup,
-//                             ioprio_weight[ioprio])
-               ret = 0;
-       else
-               ret = -ENOTSUPP;
-#endif
+       css = ub_get_blkio_css(ub);
+       ret = blkcg_set_weight(css->cgroup, ioprio_weight[ioprio]);
+       css_put(css);
        put_beancounter(ub);
 out:
        return ret;
-- 
2.1.4

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to