diff options
author | Tejun Heo <tj@kernel.org> | 2012-04-16 16:57:27 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2012-04-20 04:06:17 -0400 |
commit | f9fcc2d3919b8eb575b3cee9274feefafb641bca (patch) | |
tree | bb3eaeb993b21ba352c0967488a6955a40314d97 /block | |
parent | f95a04afa80c0f4ddd645ef6a84ed118b5d1ad46 (diff) |
blkcg: collapse blkcg_policy_ops into blkcg_policy
There's no reason to keep blkcg_policy_ops separate. Collapse it into
blkcg_policy.
This patch doesn't introduce 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')
-rw-r--r-- | block/blk-cgroup.c | 16 | ||||
-rw-r--r-- | block/blk-cgroup.h | 12 | ||||
-rw-r--r-- | block/blk-throttle.c | 13 | ||||
-rw-r--r-- | block/cfq-iosched.c | 11 |
4 files changed, 24 insertions, 28 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 3d495528a765..82283859727e 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c | |||
@@ -78,8 +78,8 @@ static void blkg_free(struct blkcg_gq *blkg) | |||
78 | if (!pd) | 78 | if (!pd) |
79 | continue; | 79 | continue; |
80 | 80 | ||
81 | if (pol && pol->ops.pd_exit_fn) | 81 | if (pol && pol->pd_exit_fn) |
82 | pol->ops.pd_exit_fn(blkg); | 82 | pol->pd_exit_fn(blkg); |
83 | 83 | ||
84 | kfree(pd); | 84 | kfree(pd); |
85 | } | 85 | } |
@@ -132,7 +132,7 @@ static struct blkcg_gq *blkg_alloc(struct blkcg *blkcg, struct request_queue *q) | |||
132 | struct blkcg_policy *pol = blkcg_policy[i]; | 132 | struct blkcg_policy *pol = blkcg_policy[i]; |
133 | 133 | ||
134 | if (blkcg_policy_enabled(blkg->q, pol)) | 134 | if (blkcg_policy_enabled(blkg->q, pol)) |
135 | pol->ops.pd_init_fn(blkg); | 135 | pol->pd_init_fn(blkg); |
136 | } | 136 | } |
137 | 137 | ||
138 | return blkg; | 138 | return blkg; |
@@ -305,8 +305,8 @@ static int blkcg_reset_stats(struct cgroup *cgroup, struct cftype *cftype, | |||
305 | struct blkcg_policy *pol = blkcg_policy[i]; | 305 | struct blkcg_policy *pol = blkcg_policy[i]; |
306 | 306 | ||
307 | if (blkcg_policy_enabled(blkg->q, pol) && | 307 | if (blkcg_policy_enabled(blkg->q, pol) && |
308 | pol->ops.pd_reset_stats_fn) | 308 | pol->pd_reset_stats_fn) |
309 | pol->ops.pd_reset_stats_fn(blkg); | 309 | pol->pd_reset_stats_fn(blkg); |
310 | } | 310 | } |
311 | } | 311 | } |
312 | 312 | ||
@@ -758,7 +758,7 @@ int blkcg_activate_policy(struct request_queue *q, | |||
758 | 758 | ||
759 | blkg->pd[pol->plid] = pd; | 759 | blkg->pd[pol->plid] = pd; |
760 | pd->blkg = blkg; | 760 | pd->blkg = blkg; |
761 | pol->ops.pd_init_fn(blkg); | 761 | pol->pd_init_fn(blkg); |
762 | 762 | ||
763 | spin_unlock(&blkg->blkcg->lock); | 763 | spin_unlock(&blkg->blkcg->lock); |
764 | } | 764 | } |
@@ -804,8 +804,8 @@ void blkcg_deactivate_policy(struct request_queue *q, | |||
804 | /* grab blkcg lock too while removing @pd from @blkg */ | 804 | /* grab blkcg lock too while removing @pd from @blkg */ |
805 | spin_lock(&blkg->blkcg->lock); | 805 | spin_lock(&blkg->blkcg->lock); |
806 | 806 | ||
807 | if (pol->ops.pd_exit_fn) | 807 | if (pol->pd_exit_fn) |
808 | pol->ops.pd_exit_fn(blkg); | 808 | pol->pd_exit_fn(blkg); |
809 | 809 | ||
810 | kfree(blkg->pd[pol->plid]); | 810 | kfree(blkg->pd[pol->plid]); |
811 | blkg->pd[pol->plid] = NULL; | 811 | blkg->pd[pol->plid] = NULL; |
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h index 18b021e1c05f..44cb9086ed42 100644 --- a/block/blk-cgroup.h +++ b/block/blk-cgroup.h | |||
@@ -99,19 +99,17 @@ typedef void (blkcg_pol_init_pd_fn)(struct blkcg_gq *blkg); | |||
99 | typedef void (blkcg_pol_exit_pd_fn)(struct blkcg_gq *blkg); | 99 | typedef void (blkcg_pol_exit_pd_fn)(struct blkcg_gq *blkg); |
100 | typedef void (blkcg_pol_reset_pd_stats_fn)(struct blkcg_gq *blkg); | 100 | typedef void (blkcg_pol_reset_pd_stats_fn)(struct blkcg_gq *blkg); |
101 | 101 | ||
102 | struct blkcg_policy_ops { | ||
103 | blkcg_pol_init_pd_fn *pd_init_fn; | ||
104 | blkcg_pol_exit_pd_fn *pd_exit_fn; | ||
105 | blkcg_pol_reset_pd_stats_fn *pd_reset_stats_fn; | ||
106 | }; | ||
107 | |||
108 | struct blkcg_policy { | 102 | struct blkcg_policy { |
109 | struct blkcg_policy_ops ops; | ||
110 | int plid; | 103 | int plid; |
111 | /* policy specific private data size */ | 104 | /* policy specific private data size */ |
112 | size_t pd_size; | 105 | size_t pd_size; |
113 | /* cgroup files for the policy */ | 106 | /* cgroup files for the policy */ |
114 | struct cftype *cftypes; | 107 | struct cftype *cftypes; |
108 | |||
109 | /* operations */ | ||
110 | blkcg_pol_init_pd_fn *pd_init_fn; | ||
111 | blkcg_pol_exit_pd_fn *pd_exit_fn; | ||
112 | blkcg_pol_reset_pd_stats_fn *pd_reset_stats_fn; | ||
115 | }; | 113 | }; |
116 | 114 | ||
117 | extern struct blkcg blkcg_root; | 115 | extern struct blkcg blkcg_root; |
diff --git a/block/blk-throttle.c b/block/blk-throttle.c index 6a0a17a83862..46310ec93d1c 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c | |||
@@ -1100,13 +1100,12 @@ static void throtl_shutdown_wq(struct request_queue *q) | |||
1100 | } | 1100 | } |
1101 | 1101 | ||
1102 | static struct blkcg_policy blkcg_policy_throtl = { | 1102 | static struct blkcg_policy blkcg_policy_throtl = { |
1103 | .ops = { | 1103 | .pd_size = sizeof(struct throtl_grp), |
1104 | .pd_init_fn = throtl_pd_init, | 1104 | .cftypes = throtl_files, |
1105 | .pd_exit_fn = throtl_pd_exit, | 1105 | |
1106 | .pd_reset_stats_fn = throtl_pd_reset_stats, | 1106 | .pd_init_fn = throtl_pd_init, |
1107 | }, | 1107 | .pd_exit_fn = throtl_pd_exit, |
1108 | .pd_size = sizeof(struct throtl_grp), | 1108 | .pd_reset_stats_fn = throtl_pd_reset_stats, |
1109 | .cftypes = throtl_files, | ||
1110 | }; | 1109 | }; |
1111 | 1110 | ||
1112 | bool blk_throtl_bio(struct request_queue *q, struct bio *bio) | 1111 | bool blk_throtl_bio(struct request_queue *q, struct bio *bio) |
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 7865cc38ea77..832b2ac8cb8d 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -4165,12 +4165,11 @@ static struct elevator_type iosched_cfq = { | |||
4165 | 4165 | ||
4166 | #ifdef CONFIG_CFQ_GROUP_IOSCHED | 4166 | #ifdef CONFIG_CFQ_GROUP_IOSCHED |
4167 | static struct blkcg_policy blkcg_policy_cfq = { | 4167 | static struct blkcg_policy blkcg_policy_cfq = { |
4168 | .ops = { | 4168 | .pd_size = sizeof(struct cfq_group), |
4169 | .pd_init_fn = cfq_pd_init, | 4169 | .cftypes = cfq_blkcg_files, |
4170 | .pd_reset_stats_fn = cfq_pd_reset_stats, | 4170 | |
4171 | }, | 4171 | .pd_init_fn = cfq_pd_init, |
4172 | .pd_size = sizeof(struct cfq_group), | 4172 | .pd_reset_stats_fn = cfq_pd_reset_stats, |
4173 | .cftypes = cfq_blkcg_files, | ||
4174 | }; | 4173 | }; |
4175 | #endif | 4174 | #endif |
4176 | 4175 | ||