aboutsummaryrefslogtreecommitdiffstats
path: root/block/cfq-iosched.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2012-04-16 16:57:25 -0400
committerJens Axboe <axboe@kernel.dk>2012-04-20 04:06:17 -0400
commit3c798398e393e5f9502dbab2b51e6c25e2e8f2ac (patch)
treed6f638e6a25dec4887e64bcc35b98bc394cb974f /block/cfq-iosched.c
parent36558c8a30e121f97b5852ae33e28081af21bdbf (diff)
blkcg: mass rename of blkcg API
During the recent blkcg cleanup, most of blkcg API has changed to such extent that mass renaming wouldn't cause any noticeable pain. Take the chance and cleanup the naming. * Rename blkio_cgroup to blkcg. * Drop blkio / blkiocg prefixes and consistently use blkcg. * Rename blkio_group to blkcg_gq, which is consistent with io_cq but keep the blkg prefix / variable name. * Rename policy method type and field names to signify they're dealing with policy data. * Rename blkio_policy_type to blkcg_policy. This patch doesn't cause any functional change. 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.c78
1 files changed, 39 insertions, 39 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 901286b5f5cb..792218281d91 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -17,7 +17,7 @@
17#include "blk.h" 17#include "blk.h"
18#include "blk-cgroup.h" 18#include "blk-cgroup.h"
19 19
20static struct blkio_policy_type blkio_policy_cfq __maybe_unused; 20static struct blkcg_policy blkcg_policy_cfq __maybe_unused;
21 21
22/* 22/*
23 * tunables 23 * tunables
@@ -202,7 +202,7 @@ struct cfqg_stats {
202 struct blkg_stat dequeue; 202 struct blkg_stat dequeue;
203 /* total time spent waiting for it to be assigned a timeslice. */ 203 /* total time spent waiting for it to be assigned a timeslice. */
204 struct blkg_stat group_wait_time; 204 struct blkg_stat group_wait_time;
205 /* time spent idling for this blkio_group */ 205 /* time spent idling for this blkcg_gq */
206 struct blkg_stat idle_time; 206 struct blkg_stat idle_time;
207 /* total time with empty current active q with other requests queued */ 207 /* total time with empty current active q with other requests queued */
208 struct blkg_stat empty_time; 208 struct blkg_stat empty_time;
@@ -553,12 +553,12 @@ static inline void cfqg_stats_update_avg_queue_size(struct cfq_group *cfqg) { }
553 553
554#ifdef CONFIG_CFQ_GROUP_IOSCHED 554#ifdef CONFIG_CFQ_GROUP_IOSCHED
555 555
556static inline struct cfq_group *blkg_to_cfqg(struct blkio_group *blkg) 556static inline struct cfq_group *blkg_to_cfqg(struct blkcg_gq *blkg)
557{ 557{
558 return blkg_to_pdata(blkg, &blkio_policy_cfq); 558 return blkg_to_pdata(blkg, &blkcg_policy_cfq);
559} 559}
560 560
561static inline struct blkio_group *cfqg_to_blkg(struct cfq_group *cfqg) 561static inline struct blkcg_gq *cfqg_to_blkg(struct cfq_group *cfqg)
562{ 562{
563 return pdata_to_blkg(cfqg); 563 return pdata_to_blkg(cfqg);
564} 564}
@@ -637,7 +637,7 @@ static inline void cfqg_stats_update_completion(struct cfq_group *cfqg,
637 io_start_time - start_time); 637 io_start_time - start_time);
638} 638}
639 639
640static void cfqg_stats_reset(struct blkio_group *blkg) 640static void cfq_pd_reset_stats(struct blkcg_gq *blkg)
641{ 641{
642 struct cfq_group *cfqg = blkg_to_cfqg(blkg); 642 struct cfq_group *cfqg = blkg_to_cfqg(blkg);
643 struct cfqg_stats *stats = &cfqg->stats; 643 struct cfqg_stats *stats = &cfqg->stats;
@@ -662,8 +662,8 @@ static void cfqg_stats_reset(struct blkio_group *blkg)
662 662
663#else /* CONFIG_CFQ_GROUP_IOSCHED */ 663#else /* CONFIG_CFQ_GROUP_IOSCHED */
664 664
665static inline struct cfq_group *blkg_to_cfqg(struct blkio_group *blkg) { return NULL; } 665static inline struct cfq_group *blkg_to_cfqg(struct blkcg_gq *blkg) { return NULL; }
666static inline struct blkio_group *cfqg_to_blkg(struct cfq_group *cfqg) { return NULL; } 666static inline struct blkcg_gq *cfqg_to_blkg(struct cfq_group *cfqg) { return NULL; }
667static inline void cfqg_get(struct cfq_group *cfqg) { } 667static inline void cfqg_get(struct cfq_group *cfqg) { }
668static inline void cfqg_put(struct cfq_group *cfqg) { } 668static inline void cfqg_put(struct cfq_group *cfqg) { }
669 669
@@ -1331,7 +1331,7 @@ static void cfq_init_cfqg_base(struct cfq_group *cfqg)
1331} 1331}
1332 1332
1333#ifdef CONFIG_CFQ_GROUP_IOSCHED 1333#ifdef CONFIG_CFQ_GROUP_IOSCHED
1334static void cfq_init_blkio_group(struct blkio_group *blkg) 1334static void cfq_pd_init(struct blkcg_gq *blkg)
1335{ 1335{
1336 struct cfq_group *cfqg = blkg_to_cfqg(blkg); 1336 struct cfq_group *cfqg = blkg_to_cfqg(blkg);
1337 1337
@@ -1344,16 +1344,16 @@ static void cfq_init_blkio_group(struct blkio_group *blkg)
1344 * be held. 1344 * be held.
1345 */ 1345 */
1346static struct cfq_group *cfq_lookup_create_cfqg(struct cfq_data *cfqd, 1346static struct cfq_group *cfq_lookup_create_cfqg(struct cfq_data *cfqd,
1347 struct blkio_cgroup *blkcg) 1347 struct blkcg *blkcg)
1348{ 1348{
1349 struct request_queue *q = cfqd->queue; 1349 struct request_queue *q = cfqd->queue;
1350 struct cfq_group *cfqg = NULL; 1350 struct cfq_group *cfqg = NULL;
1351 1351
1352 /* avoid lookup for the common case where there's no blkio cgroup */ 1352 /* avoid lookup for the common case where there's no blkcg */
1353 if (blkcg == &blkio_root_cgroup) { 1353 if (blkcg == &blkcg_root) {
1354 cfqg = cfqd->root_group; 1354 cfqg = cfqd->root_group;
1355 } else { 1355 } else {
1356 struct blkio_group *blkg; 1356 struct blkcg_gq *blkg;
1357 1357
1358 blkg = blkg_lookup_create(blkcg, q); 1358 blkg = blkg_lookup_create(blkcg, q);
1359 if (!IS_ERR(blkg)) 1359 if (!IS_ERR(blkg))
@@ -1386,8 +1386,8 @@ static u64 cfqg_prfill_weight_device(struct seq_file *sf, void *pdata, int off)
1386static int cfqg_print_weight_device(struct cgroup *cgrp, struct cftype *cft, 1386static int cfqg_print_weight_device(struct cgroup *cgrp, struct cftype *cft,
1387 struct seq_file *sf) 1387 struct seq_file *sf)
1388{ 1388{
1389 blkcg_print_blkgs(sf, cgroup_to_blkio_cgroup(cgrp), 1389 blkcg_print_blkgs(sf, cgroup_to_blkcg(cgrp),
1390 cfqg_prfill_weight_device, &blkio_policy_cfq, 0, 1390 cfqg_prfill_weight_device, &blkcg_policy_cfq, 0,
1391 false); 1391 false);
1392 return 0; 1392 return 0;
1393} 1393}
@@ -1395,19 +1395,19 @@ static int cfqg_print_weight_device(struct cgroup *cgrp, struct cftype *cft,
1395static int cfq_print_weight(struct cgroup *cgrp, struct cftype *cft, 1395static int cfq_print_weight(struct cgroup *cgrp, struct cftype *cft,
1396 struct seq_file *sf) 1396 struct seq_file *sf)
1397{ 1397{
1398 seq_printf(sf, "%u\n", cgroup_to_blkio_cgroup(cgrp)->cfq_weight); 1398 seq_printf(sf, "%u\n", cgroup_to_blkcg(cgrp)->cfq_weight);
1399 return 0; 1399 return 0;
1400} 1400}
1401 1401
1402static int cfqg_set_weight_device(struct cgroup *cgrp, struct cftype *cft, 1402static int cfqg_set_weight_device(struct cgroup *cgrp, struct cftype *cft,
1403 const char *buf) 1403 const char *buf)
1404{ 1404{
1405 struct blkio_cgroup *blkcg = cgroup_to_blkio_cgroup(cgrp); 1405 struct blkcg *blkcg = cgroup_to_blkcg(cgrp);
1406 struct blkg_conf_ctx ctx; 1406 struct blkg_conf_ctx ctx;
1407 struct cfq_group *cfqg; 1407 struct cfq_group *cfqg;
1408 int ret; 1408 int ret;
1409 1409
1410 ret = blkg_conf_prep(blkcg, &blkio_policy_cfq, buf, &ctx); 1410 ret = blkg_conf_prep(blkcg, &blkcg_policy_cfq, buf, &ctx);
1411 if (ret) 1411 if (ret)
1412 return ret; 1412 return ret;
1413 1413
@@ -1425,8 +1425,8 @@ static int cfqg_set_weight_device(struct cgroup *cgrp, struct cftype *cft,
1425 1425
1426static int cfq_set_weight(struct cgroup *cgrp, struct cftype *cft, u64 val) 1426static int cfq_set_weight(struct cgroup *cgrp, struct cftype *cft, u64 val)
1427{ 1427{
1428 struct blkio_cgroup *blkcg = cgroup_to_blkio_cgroup(cgrp); 1428 struct blkcg *blkcg = cgroup_to_blkcg(cgrp);
1429 struct blkio_group *blkg; 1429 struct blkcg_gq *blkg;
1430 struct hlist_node *n; 1430 struct hlist_node *n;
1431 1431
1432 if (val < CFQ_WEIGHT_MIN || val > CFQ_WEIGHT_MAX) 1432 if (val < CFQ_WEIGHT_MIN || val > CFQ_WEIGHT_MAX)
@@ -1449,9 +1449,9 @@ static int cfq_set_weight(struct cgroup *cgrp, struct cftype *cft, u64 val)
1449static int cfqg_print_stat(struct cgroup *cgrp, struct cftype *cft, 1449static int cfqg_print_stat(struct cgroup *cgrp, struct cftype *cft,
1450 struct seq_file *sf) 1450 struct seq_file *sf)
1451{ 1451{
1452 struct blkio_cgroup *blkcg = cgroup_to_blkio_cgroup(cgrp); 1452 struct blkcg *blkcg = cgroup_to_blkcg(cgrp);
1453 1453
1454 blkcg_print_blkgs(sf, blkcg, blkg_prfill_stat, &blkio_policy_cfq, 1454 blkcg_print_blkgs(sf, blkcg, blkg_prfill_stat, &blkcg_policy_cfq,
1455 cft->private, false); 1455 cft->private, false);
1456 return 0; 1456 return 0;
1457} 1457}
@@ -1459,9 +1459,9 @@ static int cfqg_print_stat(struct cgroup *cgrp, struct cftype *cft,
1459static int cfqg_print_rwstat(struct cgroup *cgrp, struct cftype *cft, 1459static int cfqg_print_rwstat(struct cgroup *cgrp, struct cftype *cft,
1460 struct seq_file *sf) 1460 struct seq_file *sf)
1461{ 1461{
1462 struct blkio_cgroup *blkcg = cgroup_to_blkio_cgroup(cgrp); 1462 struct blkcg *blkcg = cgroup_to_blkcg(cgrp);
1463 1463
1464 blkcg_print_blkgs(sf, blkcg, blkg_prfill_rwstat, &blkio_policy_cfq, 1464 blkcg_print_blkgs(sf, blkcg, blkg_prfill_rwstat, &blkcg_policy_cfq,
1465 cft->private, true); 1465 cft->private, true);
1466 return 0; 1466 return 0;
1467} 1467}
@@ -1485,10 +1485,10 @@ static u64 cfqg_prfill_avg_queue_size(struct seq_file *sf, void *pdata, int off)
1485static int cfqg_print_avg_queue_size(struct cgroup *cgrp, struct cftype *cft, 1485static int cfqg_print_avg_queue_size(struct cgroup *cgrp, struct cftype *cft,
1486 struct seq_file *sf) 1486 struct seq_file *sf)
1487{ 1487{
1488 struct blkio_cgroup *blkcg = cgroup_to_blkio_cgroup(cgrp); 1488 struct blkcg *blkcg = cgroup_to_blkcg(cgrp);
1489 1489
1490 blkcg_print_blkgs(sf, blkcg, cfqg_prfill_avg_queue_size, 1490 blkcg_print_blkgs(sf, blkcg, cfqg_prfill_avg_queue_size,
1491 &blkio_policy_cfq, 0, false); 1491 &blkcg_policy_cfq, 0, false);
1492 return 0; 1492 return 0;
1493} 1493}
1494#endif /* CONFIG_DEBUG_BLK_CGROUP */ 1494#endif /* CONFIG_DEBUG_BLK_CGROUP */
@@ -1580,7 +1580,7 @@ static struct cftype cfq_blkcg_files[] = {
1580}; 1580};
1581#else /* GROUP_IOSCHED */ 1581#else /* GROUP_IOSCHED */
1582static struct cfq_group *cfq_lookup_create_cfqg(struct cfq_data *cfqd, 1582static struct cfq_group *cfq_lookup_create_cfqg(struct cfq_data *cfqd,
1583 struct blkio_cgroup *blkcg) 1583 struct blkcg *blkcg)
1584{ 1584{
1585 return cfqd->root_group; 1585 return cfqd->root_group;
1586} 1586}
@@ -3135,7 +3135,7 @@ static void check_blkcg_changed(struct cfq_io_cq *cic, struct bio *bio)
3135 uint64_t id; 3135 uint64_t id;
3136 3136
3137 rcu_read_lock(); 3137 rcu_read_lock();
3138 id = bio_blkio_cgroup(bio)->id; 3138 id = bio_blkcg(bio)->id;
3139 rcu_read_unlock(); 3139 rcu_read_unlock();
3140 3140
3141 /* 3141 /*
@@ -3166,14 +3166,14 @@ static struct cfq_queue *
3166cfq_find_alloc_queue(struct cfq_data *cfqd, bool is_sync, struct cfq_io_cq *cic, 3166cfq_find_alloc_queue(struct cfq_data *cfqd, bool is_sync, struct cfq_io_cq *cic,
3167 struct bio *bio, gfp_t gfp_mask) 3167 struct bio *bio, gfp_t gfp_mask)
3168{ 3168{
3169 struct blkio_cgroup *blkcg; 3169 struct blkcg *blkcg;
3170 struct cfq_queue *cfqq, *new_cfqq = NULL; 3170 struct cfq_queue *cfqq, *new_cfqq = NULL;
3171 struct cfq_group *cfqg; 3171 struct cfq_group *cfqg;
3172 3172
3173retry: 3173retry:
3174 rcu_read_lock(); 3174 rcu_read_lock();
3175 3175
3176 blkcg = bio_blkio_cgroup(bio); 3176 blkcg = bio_blkcg(bio);
3177 cfqg = cfq_lookup_create_cfqg(cfqd, blkcg); 3177 cfqg = cfq_lookup_create_cfqg(cfqd, blkcg);
3178 cfqq = cic_to_cfqq(cic, is_sync); 3178 cfqq = cic_to_cfqq(cic, is_sync);
3179 3179
@@ -3944,14 +3944,14 @@ static void cfq_exit_queue(struct elevator_queue *e)
3944#ifndef CONFIG_CFQ_GROUP_IOSCHED 3944#ifndef CONFIG_CFQ_GROUP_IOSCHED
3945 kfree(cfqd->root_group); 3945 kfree(cfqd->root_group);
3946#endif 3946#endif
3947 blkcg_deactivate_policy(q, &blkio_policy_cfq); 3947 blkcg_deactivate_policy(q, &blkcg_policy_cfq);
3948 kfree(cfqd); 3948 kfree(cfqd);
3949} 3949}
3950 3950
3951static int cfq_init_queue(struct request_queue *q) 3951static int cfq_init_queue(struct request_queue *q)
3952{ 3952{
3953 struct cfq_data *cfqd; 3953 struct cfq_data *cfqd;
3954 struct blkio_group *blkg __maybe_unused; 3954 struct blkcg_gq *blkg __maybe_unused;
3955 int i, ret; 3955 int i, ret;
3956 3956
3957 cfqd = kmalloc_node(sizeof(*cfqd), GFP_KERNEL | __GFP_ZERO, q->node); 3957 cfqd = kmalloc_node(sizeof(*cfqd), GFP_KERNEL | __GFP_ZERO, q->node);
@@ -3966,7 +3966,7 @@ static int cfq_init_queue(struct request_queue *q)
3966 3966
3967 /* Init root group and prefer root group over other groups by default */ 3967 /* Init root group and prefer root group over other groups by default */
3968#ifdef CONFIG_CFQ_GROUP_IOSCHED 3968#ifdef CONFIG_CFQ_GROUP_IOSCHED
3969 ret = blkcg_activate_policy(q, &blkio_policy_cfq); 3969 ret = blkcg_activate_policy(q, &blkcg_policy_cfq);
3970 if (ret) 3970 if (ret)
3971 goto out_free; 3971 goto out_free;
3972 3972
@@ -4156,10 +4156,10 @@ static struct elevator_type iosched_cfq = {
4156}; 4156};
4157 4157
4158#ifdef CONFIG_CFQ_GROUP_IOSCHED 4158#ifdef CONFIG_CFQ_GROUP_IOSCHED
4159static struct blkio_policy_type blkio_policy_cfq = { 4159static struct blkcg_policy blkcg_policy_cfq = {
4160 .ops = { 4160 .ops = {
4161 .blkio_init_group_fn = cfq_init_blkio_group, 4161 .pd_init_fn = cfq_pd_init,
4162 .blkio_reset_group_stats_fn = cfqg_stats_reset, 4162 .pd_reset_stats_fn = cfq_pd_reset_stats,
4163 }, 4163 },
4164 .pdata_size = sizeof(struct cfq_group), 4164 .pdata_size = sizeof(struct cfq_group),
4165 .cftypes = cfq_blkcg_files, 4165 .cftypes = cfq_blkcg_files,
@@ -4185,7 +4185,7 @@ static int __init cfq_init(void)
4185 cfq_group_idle = 0; 4185 cfq_group_idle = 0;
4186#endif 4186#endif
4187 4187
4188 ret = blkio_policy_register(&blkio_policy_cfq); 4188 ret = blkcg_policy_register(&blkcg_policy_cfq);
4189 if (ret) 4189 if (ret)
4190 return ret; 4190 return ret;
4191 4191
@@ -4202,13 +4202,13 @@ static int __init cfq_init(void)
4202err_free_pool: 4202err_free_pool:
4203 kmem_cache_destroy(cfq_pool); 4203 kmem_cache_destroy(cfq_pool);
4204err_pol_unreg: 4204err_pol_unreg:
4205 blkio_policy_unregister(&blkio_policy_cfq); 4205 blkcg_policy_unregister(&blkcg_policy_cfq);
4206 return ret; 4206 return ret;
4207} 4207}
4208 4208
4209static void __exit cfq_exit(void) 4209static void __exit cfq_exit(void)
4210{ 4210{
4211 blkio_policy_unregister(&blkio_policy_cfq); 4211 blkcg_policy_unregister(&blkcg_policy_cfq);
4212 elv_unregister(&iosched_cfq); 4212 elv_unregister(&iosched_cfq);
4213 kmem_cache_destroy(cfq_pool); 4213 kmem_cache_destroy(cfq_pool);
4214} 4214}