aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/cfq-iosched.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index cadc37841744..d7494637c5db 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1275,12 +1275,16 @@ __cfq_group_service_tree_add(struct cfq_rb_root *st, struct cfq_group *cfqg)
1275static void 1275static void
1276cfq_update_group_weight(struct cfq_group *cfqg) 1276cfq_update_group_weight(struct cfq_group *cfqg)
1277{ 1277{
1278 BUG_ON(!RB_EMPTY_NODE(&cfqg->rb_node));
1279
1280 if (cfqg->new_weight) { 1278 if (cfqg->new_weight) {
1281 cfqg->weight = cfqg->new_weight; 1279 cfqg->weight = cfqg->new_weight;
1282 cfqg->new_weight = 0; 1280 cfqg->new_weight = 0;
1283 } 1281 }
1282}
1283
1284static void
1285cfq_update_group_leaf_weight(struct cfq_group *cfqg)
1286{
1287 BUG_ON(!RB_EMPTY_NODE(&cfqg->rb_node));
1284 1288
1285 if (cfqg->new_leaf_weight) { 1289 if (cfqg->new_leaf_weight) {
1286 cfqg->leaf_weight = cfqg->new_leaf_weight; 1290 cfqg->leaf_weight = cfqg->new_leaf_weight;
@@ -1299,7 +1303,7 @@ cfq_group_service_tree_add(struct cfq_rb_root *st, struct cfq_group *cfqg)
1299 /* add to the service tree */ 1303 /* add to the service tree */
1300 BUG_ON(!RB_EMPTY_NODE(&cfqg->rb_node)); 1304 BUG_ON(!RB_EMPTY_NODE(&cfqg->rb_node));
1301 1305
1302 cfq_update_group_weight(cfqg); 1306 cfq_update_group_leaf_weight(cfqg);
1303 __cfq_group_service_tree_add(st, cfqg); 1307 __cfq_group_service_tree_add(st, cfqg);
1304 1308
1305 /* 1309 /*
@@ -1323,6 +1327,7 @@ cfq_group_service_tree_add(struct cfq_rb_root *st, struct cfq_group *cfqg)
1323 */ 1327 */
1324 while ((parent = cfqg_parent(pos))) { 1328 while ((parent = cfqg_parent(pos))) {
1325 if (propagate) { 1329 if (propagate) {
1330 cfq_update_group_weight(pos);
1326 propagate = !parent->nr_active++; 1331 propagate = !parent->nr_active++;
1327 parent->children_weight += pos->weight; 1332 parent->children_weight += pos->weight;
1328 } 1333 }