diff options
author | Tejun Heo <tj@kernel.org> | 2012-04-13 16:11:27 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2012-04-20 04:06:06 -0400 |
commit | ec399347d39fb2337ebace928cf4a2855bd0ec37 (patch) | |
tree | d95efeb004e8da914f7d3c726cd059b422443694 | |
parent | bc0d6501a844392ab6ad419d7ca5af4693b6afac (diff) |
blkcg: use @pol instead of @plid in update_root_blkg_pd() and blkcg_print_blkgs()
The two functions were taking "enum blkio_policy_id plid". Make them
take "const struct blkio_policy_type *pol" instead.
This is to prepare for per-queue policy activation and doesn't cause
any functional difference.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | block/blk-cgroup.c | 21 | ||||
-rw-r--r-- | block/blk-cgroup.h | 7 | ||||
-rw-r--r-- | block/blk-throttle.c | 6 | ||||
-rw-r--r-- | block/cfq-iosched.c | 10 |
4 files changed, 23 insertions, 21 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index af665fe7f4f2..b1231524a097 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c | |||
@@ -226,17 +226,17 @@ static void blkg_destroy(struct blkio_group *blkg) | |||
226 | * aren't shot down. This broken and racy implementation is temporary. | 226 | * aren't shot down. This broken and racy implementation is temporary. |
227 | * Eventually, blkg shoot down will be replaced by proper in-place update. | 227 | * Eventually, blkg shoot down will be replaced by proper in-place update. |
228 | */ | 228 | */ |
229 | void update_root_blkg_pd(struct request_queue *q, enum blkio_policy_id plid) | 229 | void update_root_blkg_pd(struct request_queue *q, |
230 | const struct blkio_policy_type *pol) | ||
230 | { | 231 | { |
231 | struct blkio_policy_type *pol = blkio_policy[plid]; | ||
232 | struct blkio_group *blkg = blkg_lookup(&blkio_root_cgroup, q); | 232 | struct blkio_group *blkg = blkg_lookup(&blkio_root_cgroup, q); |
233 | struct blkg_policy_data *pd; | 233 | struct blkg_policy_data *pd; |
234 | 234 | ||
235 | if (!blkg) | 235 | if (!blkg) |
236 | return; | 236 | return; |
237 | 237 | ||
238 | kfree(blkg->pd[plid]); | 238 | kfree(blkg->pd[pol->plid]); |
239 | blkg->pd[plid] = NULL; | 239 | blkg->pd[pol->plid] = NULL; |
240 | 240 | ||
241 | if (!pol) | 241 | if (!pol) |
242 | return; | 242 | return; |
@@ -244,7 +244,7 @@ void update_root_blkg_pd(struct request_queue *q, enum blkio_policy_id plid) | |||
244 | pd = kzalloc(sizeof(*pd) + pol->pdata_size, GFP_KERNEL); | 244 | pd = kzalloc(sizeof(*pd) + pol->pdata_size, GFP_KERNEL); |
245 | WARN_ON_ONCE(!pd); | 245 | WARN_ON_ONCE(!pd); |
246 | 246 | ||
247 | blkg->pd[plid] = pd; | 247 | blkg->pd[pol->plid] = pd; |
248 | pd->blkg = blkg; | 248 | pd->blkg = blkg; |
249 | pol->ops.blkio_init_group_fn(blkg); | 249 | pol->ops.blkio_init_group_fn(blkg); |
250 | } | 250 | } |
@@ -360,7 +360,8 @@ static const char *blkg_dev_name(struct blkio_group *blkg) | |||
360 | */ | 360 | */ |
361 | void blkcg_print_blkgs(struct seq_file *sf, struct blkio_cgroup *blkcg, | 361 | void blkcg_print_blkgs(struct seq_file *sf, struct blkio_cgroup *blkcg, |
362 | u64 (*prfill)(struct seq_file *, void *, int), | 362 | u64 (*prfill)(struct seq_file *, void *, int), |
363 | int pol, int data, bool show_total) | 363 | const struct blkio_policy_type *pol, int data, |
364 | bool show_total) | ||
364 | { | 365 | { |
365 | struct blkio_group *blkg; | 366 | struct blkio_group *blkg; |
366 | struct hlist_node *n; | 367 | struct hlist_node *n; |
@@ -368,8 +369,8 @@ void blkcg_print_blkgs(struct seq_file *sf, struct blkio_cgroup *blkcg, | |||
368 | 369 | ||
369 | spin_lock_irq(&blkcg->lock); | 370 | spin_lock_irq(&blkcg->lock); |
370 | hlist_for_each_entry(blkg, n, &blkcg->blkg_list, blkcg_node) | 371 | hlist_for_each_entry(blkg, n, &blkcg->blkg_list, blkcg_node) |
371 | if (blkg->pd[pol]) | 372 | if (blkg->pd[pol->plid]) |
372 | total += prfill(sf, blkg->pd[pol]->pdata, data); | 373 | total += prfill(sf, blkg->pd[pol->plid]->pdata, data); |
373 | spin_unlock_irq(&blkcg->lock); | 374 | spin_unlock_irq(&blkcg->lock); |
374 | 375 | ||
375 | if (show_total) | 376 | if (show_total) |
@@ -739,7 +740,7 @@ void blkio_policy_register(struct blkio_policy_type *blkiop) | |||
739 | BUG_ON(blkio_policy[blkiop->plid]); | 740 | BUG_ON(blkio_policy[blkiop->plid]); |
740 | blkio_policy[blkiop->plid] = blkiop; | 741 | blkio_policy[blkiop->plid] = blkiop; |
741 | list_for_each_entry(q, &all_q_list, all_q_node) | 742 | list_for_each_entry(q, &all_q_list, all_q_node) |
742 | update_root_blkg_pd(q, blkiop->plid); | 743 | update_root_blkg_pd(q, blkiop); |
743 | 744 | ||
744 | blkcg_bypass_end(); | 745 | blkcg_bypass_end(); |
745 | 746 | ||
@@ -765,7 +766,7 @@ void blkio_policy_unregister(struct blkio_policy_type *blkiop) | |||
765 | blkio_policy[blkiop->plid] = NULL; | 766 | blkio_policy[blkiop->plid] = NULL; |
766 | 767 | ||
767 | list_for_each_entry(q, &all_q_list, all_q_node) | 768 | list_for_each_entry(q, &all_q_list, all_q_node) |
768 | update_root_blkg_pd(q, blkiop->plid); | 769 | update_root_blkg_pd(q, blkiop); |
769 | blkcg_bypass_end(); | 770 | blkcg_bypass_end(); |
770 | 771 | ||
771 | mutex_unlock(&blkcg_pol_mutex); | 772 | mutex_unlock(&blkcg_pol_mutex); |
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h index c772581c9011..26949731108f 100644 --- a/block/blk-cgroup.h +++ b/block/blk-cgroup.h | |||
@@ -117,11 +117,12 @@ extern void blkio_policy_register(struct blkio_policy_type *); | |||
117 | extern void blkio_policy_unregister(struct blkio_policy_type *); | 117 | extern void blkio_policy_unregister(struct blkio_policy_type *); |
118 | extern void blkg_destroy_all(struct request_queue *q, bool destroy_root); | 118 | extern void blkg_destroy_all(struct request_queue *q, bool destroy_root); |
119 | extern void update_root_blkg_pd(struct request_queue *q, | 119 | extern void update_root_blkg_pd(struct request_queue *q, |
120 | enum blkio_policy_id plid); | 120 | const struct blkio_policy_type *pol); |
121 | 121 | ||
122 | void blkcg_print_blkgs(struct seq_file *sf, struct blkio_cgroup *blkcg, | 122 | void blkcg_print_blkgs(struct seq_file *sf, struct blkio_cgroup *blkcg, |
123 | u64 (*prfill)(struct seq_file *, void *, int), | 123 | u64 (*prfill)(struct seq_file *, void *, int), |
124 | int pol, int data, bool show_total); | 124 | const struct blkio_policy_type *pol, int data, |
125 | bool show_total); | ||
125 | u64 __blkg_prfill_u64(struct seq_file *sf, void *pdata, u64 v); | 126 | u64 __blkg_prfill_u64(struct seq_file *sf, void *pdata, u64 v); |
126 | u64 __blkg_prfill_rwstat(struct seq_file *sf, void *pdata, | 127 | u64 __blkg_prfill_rwstat(struct seq_file *sf, void *pdata, |
127 | const struct blkg_rwstat *rwstat); | 128 | const struct blkg_rwstat *rwstat); |
@@ -333,7 +334,7 @@ static inline void blkio_policy_unregister(struct blkio_policy_type *blkiop) { } | |||
333 | static inline void blkg_destroy_all(struct request_queue *q, | 334 | static inline void blkg_destroy_all(struct request_queue *q, |
334 | bool destory_root) { } | 335 | bool destory_root) { } |
335 | static inline void update_root_blkg_pd(struct request_queue *q, | 336 | static inline void update_root_blkg_pd(struct request_queue *q, |
336 | enum blkio_policy_id plid) { } | 337 | const struct blkio_policy_type *pol) { } |
337 | 338 | ||
338 | static inline void *blkg_to_pdata(struct blkio_group *blkg, | 339 | static inline void *blkg_to_pdata(struct blkio_group *blkg, |
339 | struct blkio_policy_type *pol) { return NULL; } | 340 | struct blkio_policy_type *pol) { return NULL; } |
diff --git a/block/blk-throttle.c b/block/blk-throttle.c index 60240142f5ae..07c17c27a628 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c | |||
@@ -946,7 +946,7 @@ static int tg_print_cpu_rwstat(struct cgroup *cgrp, struct cftype *cft, | |||
946 | { | 946 | { |
947 | struct blkio_cgroup *blkcg = cgroup_to_blkio_cgroup(cgrp); | 947 | struct blkio_cgroup *blkcg = cgroup_to_blkio_cgroup(cgrp); |
948 | 948 | ||
949 | blkcg_print_blkgs(sf, blkcg, tg_prfill_cpu_rwstat, BLKIO_POLICY_THROTL, | 949 | blkcg_print_blkgs(sf, blkcg, tg_prfill_cpu_rwstat, &blkio_policy_throtl, |
950 | cft->private, true); | 950 | cft->private, true); |
951 | return 0; | 951 | return 0; |
952 | } | 952 | } |
@@ -973,7 +973,7 @@ static int tg_print_conf_u64(struct cgroup *cgrp, struct cftype *cft, | |||
973 | struct seq_file *sf) | 973 | struct seq_file *sf) |
974 | { | 974 | { |
975 | blkcg_print_blkgs(sf, cgroup_to_blkio_cgroup(cgrp), tg_prfill_conf_u64, | 975 | blkcg_print_blkgs(sf, cgroup_to_blkio_cgroup(cgrp), tg_prfill_conf_u64, |
976 | BLKIO_POLICY_THROTL, cft->private, false); | 976 | &blkio_policy_throtl, cft->private, false); |
977 | return 0; | 977 | return 0; |
978 | } | 978 | } |
979 | 979 | ||
@@ -981,7 +981,7 @@ static int tg_print_conf_uint(struct cgroup *cgrp, struct cftype *cft, | |||
981 | struct seq_file *sf) | 981 | struct seq_file *sf) |
982 | { | 982 | { |
983 | blkcg_print_blkgs(sf, cgroup_to_blkio_cgroup(cgrp), tg_prfill_conf_uint, | 983 | blkcg_print_blkgs(sf, cgroup_to_blkio_cgroup(cgrp), tg_prfill_conf_uint, |
984 | BLKIO_POLICY_THROTL, cft->private, false); | 984 | &blkio_policy_throtl, cft->private, false); |
985 | return 0; | 985 | return 0; |
986 | } | 986 | } |
987 | 987 | ||
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 7a8c3e0ab3a2..d02f0ae9637f 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -1380,7 +1380,7 @@ static int cfqg_print_weight_device(struct cgroup *cgrp, struct cftype *cft, | |||
1380 | struct seq_file *sf) | 1380 | struct seq_file *sf) |
1381 | { | 1381 | { |
1382 | blkcg_print_blkgs(sf, cgroup_to_blkio_cgroup(cgrp), | 1382 | blkcg_print_blkgs(sf, cgroup_to_blkio_cgroup(cgrp), |
1383 | cfqg_prfill_weight_device, BLKIO_POLICY_PROP, 0, | 1383 | cfqg_prfill_weight_device, &blkio_policy_cfq, 0, |
1384 | false); | 1384 | false); |
1385 | return 0; | 1385 | return 0; |
1386 | } | 1386 | } |
@@ -1445,7 +1445,7 @@ static int cfqg_print_stat(struct cgroup *cgrp, struct cftype *cft, | |||
1445 | { | 1445 | { |
1446 | struct blkio_cgroup *blkcg = cgroup_to_blkio_cgroup(cgrp); | 1446 | struct blkio_cgroup *blkcg = cgroup_to_blkio_cgroup(cgrp); |
1447 | 1447 | ||
1448 | blkcg_print_blkgs(sf, blkcg, blkg_prfill_stat, BLKIO_POLICY_PROP, | 1448 | blkcg_print_blkgs(sf, blkcg, blkg_prfill_stat, &blkio_policy_cfq, |
1449 | cft->private, false); | 1449 | cft->private, false); |
1450 | return 0; | 1450 | return 0; |
1451 | } | 1451 | } |
@@ -1455,7 +1455,7 @@ static int cfqg_print_rwstat(struct cgroup *cgrp, struct cftype *cft, | |||
1455 | { | 1455 | { |
1456 | struct blkio_cgroup *blkcg = cgroup_to_blkio_cgroup(cgrp); | 1456 | struct blkio_cgroup *blkcg = cgroup_to_blkio_cgroup(cgrp); |
1457 | 1457 | ||
1458 | blkcg_print_blkgs(sf, blkcg, blkg_prfill_rwstat, BLKIO_POLICY_PROP, | 1458 | blkcg_print_blkgs(sf, blkcg, blkg_prfill_rwstat, &blkio_policy_cfq, |
1459 | cft->private, true); | 1459 | cft->private, true); |
1460 | return 0; | 1460 | return 0; |
1461 | } | 1461 | } |
@@ -1482,7 +1482,7 @@ static int cfqg_print_avg_queue_size(struct cgroup *cgrp, struct cftype *cft, | |||
1482 | struct blkio_cgroup *blkcg = cgroup_to_blkio_cgroup(cgrp); | 1482 | struct blkio_cgroup *blkcg = cgroup_to_blkio_cgroup(cgrp); |
1483 | 1483 | ||
1484 | blkcg_print_blkgs(sf, blkcg, cfqg_prfill_avg_queue_size, | 1484 | blkcg_print_blkgs(sf, blkcg, cfqg_prfill_avg_queue_size, |
1485 | BLKIO_POLICY_PROP, 0, false); | 1485 | &blkio_policy_cfq, 0, false); |
1486 | return 0; | 1486 | return 0; |
1487 | } | 1487 | } |
1488 | #endif /* CONFIG_DEBUG_BLK_CGROUP */ | 1488 | #endif /* CONFIG_DEBUG_BLK_CGROUP */ |
@@ -3938,7 +3938,7 @@ static void cfq_exit_queue(struct elevator_queue *e) | |||
3938 | #ifndef CONFIG_CFQ_GROUP_IOSCHED | 3938 | #ifndef CONFIG_CFQ_GROUP_IOSCHED |
3939 | kfree(cfqd->root_group); | 3939 | kfree(cfqd->root_group); |
3940 | #endif | 3940 | #endif |
3941 | update_root_blkg_pd(q, BLKIO_POLICY_PROP); | 3941 | update_root_blkg_pd(q, &blkio_policy_cfq); |
3942 | kfree(cfqd); | 3942 | kfree(cfqd); |
3943 | } | 3943 | } |
3944 | 3944 | ||