diff options
-rw-r--r-- | block/blk-cgroup.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 290792a13e3c..db30b6beee72 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c | |||
@@ -235,8 +235,13 @@ static struct blkcg_gq *blkg_create(struct blkcg *blkcg, | |||
235 | blkg->online = true; | 235 | blkg->online = true; |
236 | spin_unlock(&blkcg->lock); | 236 | spin_unlock(&blkcg->lock); |
237 | 237 | ||
238 | if (!ret) | 238 | if (!ret) { |
239 | if (blkcg == &blkcg_root) { | ||
240 | q->root_blkg = blkg; | ||
241 | q->root_rl.blkg = blkg; | ||
242 | } | ||
239 | return blkg; | 243 | return blkg; |
244 | } | ||
240 | 245 | ||
241 | /* @blkg failed fully initialized, use the usual release path */ | 246 | /* @blkg failed fully initialized, use the usual release path */ |
242 | blkg_put(blkg); | 247 | blkg_put(blkg); |
@@ -335,6 +340,15 @@ static void blkg_destroy(struct blkcg_gq *blkg) | |||
335 | rcu_assign_pointer(blkcg->blkg_hint, NULL); | 340 | rcu_assign_pointer(blkcg->blkg_hint, NULL); |
336 | 341 | ||
337 | /* | 342 | /* |
343 | * If root blkg is destroyed. Just clear the pointer since root_rl | ||
344 | * does not take reference on root blkg. | ||
345 | */ | ||
346 | if (blkcg == &blkcg_root) { | ||
347 | blkg->q->root_blkg = NULL; | ||
348 | blkg->q->root_rl.blkg = NULL; | ||
349 | } | ||
350 | |||
351 | /* | ||
338 | * Put the reference taken at the time of creation so that when all | 352 | * Put the reference taken at the time of creation so that when all |
339 | * queues are gone, group can be destroyed. | 353 | * queues are gone, group can be destroyed. |
340 | */ | 354 | */ |
@@ -360,13 +374,6 @@ static void blkg_destroy_all(struct request_queue *q) | |||
360 | blkg_destroy(blkg); | 374 | blkg_destroy(blkg); |
361 | spin_unlock(&blkcg->lock); | 375 | spin_unlock(&blkcg->lock); |
362 | } | 376 | } |
363 | |||
364 | /* | ||
365 | * root blkg is destroyed. Just clear the pointer since | ||
366 | * root_rl does not take reference on root blkg. | ||
367 | */ | ||
368 | q->root_blkg = NULL; | ||
369 | q->root_rl.blkg = NULL; | ||
370 | } | 377 | } |
371 | 378 | ||
372 | /* | 379 | /* |
@@ -973,8 +980,6 @@ int blkcg_activate_policy(struct request_queue *q, | |||
973 | ret = PTR_ERR(blkg); | 980 | ret = PTR_ERR(blkg); |
974 | goto out_unlock; | 981 | goto out_unlock; |
975 | } | 982 | } |
976 | q->root_blkg = blkg; | ||
977 | q->root_rl.blkg = blkg; | ||
978 | 983 | ||
979 | list_for_each_entry(blkg, &q->blkg_list, q_node) | 984 | list_for_each_entry(blkg, &q->blkg_list, q_node) |
980 | cnt++; | 985 | cnt++; |