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 /block/blk-cgroup.c | |
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>
Diffstat (limited to 'block/blk-cgroup.c')
-rw-r--r-- | block/blk-cgroup.c | 21 |
1 files changed, 11 insertions, 10 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); |