aboutsummaryrefslogtreecommitdiffstats
path: root/block/cfq-iosched.c
diff options
context:
space:
mode:
Diffstat (limited to 'block/cfq-iosched.c')
-rw-r--r--block/cfq-iosched.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index ae5113d3ebae..fb52df9744f5 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -17,8 +17,6 @@
17#include "blk.h" 17#include "blk.h"
18#include "blk-cgroup.h" 18#include "blk-cgroup.h"
19 19
20static struct blkcg_policy blkcg_policy_cfq __maybe_unused;
21
22/* 20/*
23 * tunables 21 * tunables
24 */ 22 */
@@ -418,11 +416,6 @@ static inline struct cfq_group *pd_to_cfqg(struct blkg_policy_data *pd)
418 return pd ? container_of(pd, struct cfq_group, pd) : NULL; 416 return pd ? container_of(pd, struct cfq_group, pd) : NULL;
419} 417}
420 418
421static inline struct cfq_group *blkg_to_cfqg(struct blkcg_gq *blkg)
422{
423 return pd_to_cfqg(blkg_to_pd(blkg, &blkcg_policy_cfq));
424}
425
426static inline struct blkcg_gq *cfqg_to_blkg(struct cfq_group *cfqg) 419static inline struct blkcg_gq *cfqg_to_blkg(struct cfq_group *cfqg)
427{ 420{
428 return pd_to_blkg(&cfqg->pd); 421 return pd_to_blkg(&cfqg->pd);
@@ -572,6 +565,13 @@ static inline void cfqg_stats_update_avg_queue_size(struct cfq_group *cfqg) { }
572 565
573#ifdef CONFIG_CFQ_GROUP_IOSCHED 566#ifdef CONFIG_CFQ_GROUP_IOSCHED
574 567
568static struct blkcg_policy blkcg_policy_cfq;
569
570static inline struct cfq_group *blkg_to_cfqg(struct blkcg_gq *blkg)
571{
572 return pd_to_cfqg(blkg_to_pd(blkg, &blkcg_policy_cfq));
573}
574
575static inline void cfqg_get(struct cfq_group *cfqg) 575static inline void cfqg_get(struct cfq_group *cfqg)
576{ 576{
577 return blkg_get(cfqg_to_blkg(cfqg)); 577 return blkg_get(cfqg_to_blkg(cfqg));
@@ -3951,10 +3951,11 @@ static void cfq_exit_queue(struct elevator_queue *e)
3951 3951
3952 cfq_shutdown_timer_wq(cfqd); 3952 cfq_shutdown_timer_wq(cfqd);
3953 3953
3954#ifndef CONFIG_CFQ_GROUP_IOSCHED 3954#ifdef CONFIG_CFQ_GROUP_IOSCHED
3955 blkcg_deactivate_policy(q, &blkcg_policy_cfq);
3956#else
3955 kfree(cfqd->root_group); 3957 kfree(cfqd->root_group);
3956#endif 3958#endif
3957 blkcg_deactivate_policy(q, &blkcg_policy_cfq);
3958 kfree(cfqd); 3959 kfree(cfqd);
3959} 3960}
3960 3961
@@ -4194,13 +4195,13 @@ static int __init cfq_init(void)
4194#ifdef CONFIG_CFQ_GROUP_IOSCHED 4195#ifdef CONFIG_CFQ_GROUP_IOSCHED
4195 if (!cfq_group_idle) 4196 if (!cfq_group_idle)
4196 cfq_group_idle = 1; 4197 cfq_group_idle = 1;
4197#else
4198 cfq_group_idle = 0;
4199#endif
4200 4198
4201 ret = blkcg_policy_register(&blkcg_policy_cfq); 4199 ret = blkcg_policy_register(&blkcg_policy_cfq);
4202 if (ret) 4200 if (ret)
4203 return ret; 4201 return ret;
4202#else
4203 cfq_group_idle = 0;
4204#endif
4204 4205
4205 ret = -ENOMEM; 4206 ret = -ENOMEM;
4206 cfq_pool = KMEM_CACHE(cfq_queue, 0); 4207 cfq_pool = KMEM_CACHE(cfq_queue, 0);
@@ -4216,13 +4217,17 @@ static int __init cfq_init(void)
4216err_free_pool: 4217err_free_pool:
4217 kmem_cache_destroy(cfq_pool); 4218 kmem_cache_destroy(cfq_pool);
4218err_pol_unreg: 4219err_pol_unreg:
4220#ifdef CONFIG_CFQ_GROUP_IOSCHED
4219 blkcg_policy_unregister(&blkcg_policy_cfq); 4221 blkcg_policy_unregister(&blkcg_policy_cfq);
4222#endif
4220 return ret; 4223 return ret;
4221} 4224}
4222 4225
4223static void __exit cfq_exit(void) 4226static void __exit cfq_exit(void)
4224{ 4227{
4228#ifdef CONFIG_CFQ_GROUP_IOSCHED
4225 blkcg_policy_unregister(&blkcg_policy_cfq); 4229 blkcg_policy_unregister(&blkcg_policy_cfq);
4230#endif
4226 elv_unregister(&iosched_cfq); 4231 elv_unregister(&iosched_cfq);
4227 kmem_cache_destroy(cfq_pool); 4232 kmem_cache_destroy(cfq_pool);
4228} 4233}