diff options
author | Tejun Heo <tj@kernel.org> | 2012-04-13 16:11:28 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2012-04-20 04:06:06 -0400 |
commit | 8bd435b30ecacb69bbb8b2d3e251f770b807c5b2 (patch) | |
tree | a1a50e95517a54a578af3967fb4016a5a1a42a68 /block/cfq-iosched.c | |
parent | ec399347d39fb2337ebace928cf4a2855bd0ec37 (diff) |
blkcg: remove static policy ID enums
Remove BLKIO_POLICY_* enums and let blkio_policy_register() allocate
@pol->plid dynamically on registration. The maximum number of blkcg
policies which can be registered at the same time is defined by
BLKCG_MAX_POLS constant added to include/linux/blkdev.h.
Note that blkio_policy_register() now may fail. Policy init functions
updated accordingly and unnecessary ifdefs removed from cfq_init().
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/cfq-iosched.c')
-rw-r--r-- | block/cfq-iosched.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index d02f0ae9637f..08db2fc70c29 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -4157,7 +4157,6 @@ static struct blkio_policy_type blkio_policy_cfq = { | |||
4157 | .blkio_init_group_fn = cfq_init_blkio_group, | 4157 | .blkio_init_group_fn = cfq_init_blkio_group, |
4158 | .blkio_reset_group_stats_fn = cfqg_stats_reset, | 4158 | .blkio_reset_group_stats_fn = cfqg_stats_reset, |
4159 | }, | 4159 | }, |
4160 | .plid = BLKIO_POLICY_PROP, | ||
4161 | .pdata_size = sizeof(struct cfq_group), | 4160 | .pdata_size = sizeof(struct cfq_group), |
4162 | .cftypes = cfq_blkcg_files, | 4161 | .cftypes = cfq_blkcg_files, |
4163 | }; | 4162 | }; |
@@ -4181,27 +4180,31 @@ static int __init cfq_init(void) | |||
4181 | #else | 4180 | #else |
4182 | cfq_group_idle = 0; | 4181 | cfq_group_idle = 0; |
4183 | #endif | 4182 | #endif |
4183 | |||
4184 | ret = blkio_policy_register(&blkio_policy_cfq); | ||
4185 | if (ret) | ||
4186 | return ret; | ||
4187 | |||
4184 | cfq_pool = KMEM_CACHE(cfq_queue, 0); | 4188 | cfq_pool = KMEM_CACHE(cfq_queue, 0); |
4185 | if (!cfq_pool) | 4189 | if (!cfq_pool) |
4186 | return -ENOMEM; | 4190 | goto err_pol_unreg; |
4187 | 4191 | ||
4188 | ret = elv_register(&iosched_cfq); | 4192 | ret = elv_register(&iosched_cfq); |
4189 | if (ret) { | 4193 | if (ret) |
4190 | kmem_cache_destroy(cfq_pool); | 4194 | goto err_free_pool; |
4191 | return ret; | ||
4192 | } | ||
4193 | 4195 | ||
4194 | #ifdef CONFIG_CFQ_GROUP_IOSCHED | ||
4195 | blkio_policy_register(&blkio_policy_cfq); | ||
4196 | #endif | ||
4197 | return 0; | 4196 | return 0; |
4197 | |||
4198 | err_free_pool: | ||
4199 | kmem_cache_destroy(cfq_pool); | ||
4200 | err_pol_unreg: | ||
4201 | blkio_policy_unregister(&blkio_policy_cfq); | ||
4202 | return ret; | ||
4198 | } | 4203 | } |
4199 | 4204 | ||
4200 | static void __exit cfq_exit(void) | 4205 | static void __exit cfq_exit(void) |
4201 | { | 4206 | { |
4202 | #ifdef CONFIG_CFQ_GROUP_IOSCHED | ||
4203 | blkio_policy_unregister(&blkio_policy_cfq); | 4207 | blkio_policy_unregister(&blkio_policy_cfq); |
4204 | #endif | ||
4205 | elv_unregister(&iosched_cfq); | 4208 | elv_unregister(&iosched_cfq); |
4206 | kmem_cache_destroy(cfq_pool); | 4209 | kmem_cache_destroy(cfq_pool); |
4207 | } | 4210 | } |