aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/blk-cgroup.c7
-rw-r--r--block/cfq-iosched.c6
2 files changed, 13 insertions, 0 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 4ef78d35cbd2..179ddfaebc5c 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -16,6 +16,7 @@
16#include "blk-cgroup.h" 16#include "blk-cgroup.h"
17 17
18extern void cfq_unlink_blkio_group(void *, struct blkio_group *); 18extern void cfq_unlink_blkio_group(void *, struct blkio_group *);
19extern void cfq_update_blkio_group_weight(struct blkio_group *, unsigned int);
19 20
20struct blkio_cgroup blkio_root_cgroup = { .weight = 2*BLKIO_WEIGHT_DEFAULT }; 21struct blkio_cgroup blkio_root_cgroup = { .weight = 2*BLKIO_WEIGHT_DEFAULT };
21 22
@@ -116,12 +117,18 @@ static int
116blkiocg_weight_write(struct cgroup *cgroup, struct cftype *cftype, u64 val) 117blkiocg_weight_write(struct cgroup *cgroup, struct cftype *cftype, u64 val)
117{ 118{
118 struct blkio_cgroup *blkcg; 119 struct blkio_cgroup *blkcg;
120 struct blkio_group *blkg;
121 struct hlist_node *n;
119 122
120 if (val < BLKIO_WEIGHT_MIN || val > BLKIO_WEIGHT_MAX) 123 if (val < BLKIO_WEIGHT_MIN || val > BLKIO_WEIGHT_MAX)
121 return -EINVAL; 124 return -EINVAL;
122 125
123 blkcg = cgroup_to_blkio_cgroup(cgroup); 126 blkcg = cgroup_to_blkio_cgroup(cgroup);
127 spin_lock_irq(&blkcg->lock);
124 blkcg->weight = (unsigned int)val; 128 blkcg->weight = (unsigned int)val;
129 hlist_for_each_entry(blkg, n, &blkcg->blkg_list, blkcg_node)
130 cfq_update_blkio_group_weight(blkg, blkcg->weight);
131 spin_unlock_irq(&blkcg->lock);
125 return 0; 132 return 0;
126} 133}
127 134
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 3d99e45789bd..f7364621613a 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -922,6 +922,12 @@ static inline struct cfq_group *cfqg_of_blkg(struct blkio_group *blkg)
922 return NULL; 922 return NULL;
923} 923}
924 924
925void
926cfq_update_blkio_group_weight(struct blkio_group *blkg, unsigned int weight)
927{
928 cfqg_of_blkg(blkg)->weight = weight;
929}
930
925static struct cfq_group * 931static struct cfq_group *
926cfq_find_alloc_cfqg(struct cfq_data *cfqd, struct cgroup *cgroup, int create) 932cfq_find_alloc_cfqg(struct cfq_data *cfqd, struct cgroup *cgroup, int create)
927{ 933{