diff options
author | Tejun Heo <tj@kernel.org> | 2012-06-04 23:40:57 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2012-06-25 05:53:50 -0400 |
commit | b1208b56f31408f7d8381ff5d08e970aa5ee761c (patch) | |
tree | d077f86201fc7dee7ae23065c2c3d929219d1e5f /block | |
parent | 7f4b35d155a5f9e5748539a79558533aa08d6a81 (diff) |
blkcg: inline bio_blkcg() and friends
Make bio_blkcg() and friends inline. They all are very simple and
used only in few places.
This patch is to prepare for further updates to request allocation
path.
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-cgroup.c | 21 | ||||
-rw-r--r-- | block/blk-cgroup.h | 26 |
2 files changed, 22 insertions, 25 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 96248d2578db..63b31ebae6e2 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c | |||
@@ -31,27 +31,6 @@ EXPORT_SYMBOL_GPL(blkcg_root); | |||
31 | 31 | ||
32 | static struct blkcg_policy *blkcg_policy[BLKCG_MAX_POLS]; | 32 | static struct blkcg_policy *blkcg_policy[BLKCG_MAX_POLS]; |
33 | 33 | ||
34 | struct blkcg *cgroup_to_blkcg(struct cgroup *cgroup) | ||
35 | { | ||
36 | return container_of(cgroup_subsys_state(cgroup, blkio_subsys_id), | ||
37 | struct blkcg, css); | ||
38 | } | ||
39 | EXPORT_SYMBOL_GPL(cgroup_to_blkcg); | ||
40 | |||
41 | static struct blkcg *task_blkcg(struct task_struct *tsk) | ||
42 | { | ||
43 | return container_of(task_subsys_state(tsk, blkio_subsys_id), | ||
44 | struct blkcg, css); | ||
45 | } | ||
46 | |||
47 | struct blkcg *bio_blkcg(struct bio *bio) | ||
48 | { | ||
49 | if (bio && bio->bi_css) | ||
50 | return container_of(bio->bi_css, struct blkcg, css); | ||
51 | return task_blkcg(current); | ||
52 | } | ||
53 | EXPORT_SYMBOL_GPL(bio_blkcg); | ||
54 | |||
55 | static bool blkcg_policy_enabled(struct request_queue *q, | 34 | static bool blkcg_policy_enabled(struct request_queue *q, |
56 | const struct blkcg_policy *pol) | 35 | const struct blkcg_policy *pol) |
57 | { | 36 | { |
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h index 8ac457ce7783..e74cce1fbac9 100644 --- a/block/blk-cgroup.h +++ b/block/blk-cgroup.h | |||
@@ -120,8 +120,6 @@ struct blkcg_policy { | |||
120 | 120 | ||
121 | extern struct blkcg blkcg_root; | 121 | extern struct blkcg blkcg_root; |
122 | 122 | ||
123 | struct blkcg *cgroup_to_blkcg(struct cgroup *cgroup); | ||
124 | struct blkcg *bio_blkcg(struct bio *bio); | ||
125 | struct blkcg_gq *blkg_lookup(struct blkcg *blkcg, struct request_queue *q); | 123 | struct blkcg_gq *blkg_lookup(struct blkcg *blkcg, struct request_queue *q); |
126 | struct blkcg_gq *blkg_lookup_create(struct blkcg *blkcg, | 124 | struct blkcg_gq *blkg_lookup_create(struct blkcg *blkcg, |
127 | struct request_queue *q); | 125 | struct request_queue *q); |
@@ -160,6 +158,25 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol, | |||
160 | void blkg_conf_finish(struct blkg_conf_ctx *ctx); | 158 | void blkg_conf_finish(struct blkg_conf_ctx *ctx); |
161 | 159 | ||
162 | 160 | ||
161 | static inline struct blkcg *cgroup_to_blkcg(struct cgroup *cgroup) | ||
162 | { | ||
163 | return container_of(cgroup_subsys_state(cgroup, blkio_subsys_id), | ||
164 | struct blkcg, css); | ||
165 | } | ||
166 | |||
167 | static inline struct blkcg *task_blkcg(struct task_struct *tsk) | ||
168 | { | ||
169 | return container_of(task_subsys_state(tsk, blkio_subsys_id), | ||
170 | struct blkcg, css); | ||
171 | } | ||
172 | |||
173 | static inline struct blkcg *bio_blkcg(struct bio *bio) | ||
174 | { | ||
175 | if (bio && bio->bi_css) | ||
176 | return container_of(bio->bi_css, struct blkcg, css); | ||
177 | return task_blkcg(current); | ||
178 | } | ||
179 | |||
163 | /** | 180 | /** |
164 | * blkg_to_pdata - get policy private data | 181 | * blkg_to_pdata - get policy private data |
165 | * @blkg: blkg of interest | 182 | * @blkg: blkg of interest |
@@ -351,6 +368,7 @@ static inline void blkg_rwstat_reset(struct blkg_rwstat *rwstat) | |||
351 | #else /* CONFIG_BLK_CGROUP */ | 368 | #else /* CONFIG_BLK_CGROUP */ |
352 | 369 | ||
353 | struct cgroup; | 370 | struct cgroup; |
371 | struct blkcg; | ||
354 | 372 | ||
355 | struct blkg_policy_data { | 373 | struct blkg_policy_data { |
356 | }; | 374 | }; |
@@ -361,8 +379,6 @@ struct blkcg_gq { | |||
361 | struct blkcg_policy { | 379 | struct blkcg_policy { |
362 | }; | 380 | }; |
363 | 381 | ||
364 | static inline struct blkcg *cgroup_to_blkcg(struct cgroup *cgroup) { return NULL; } | ||
365 | static inline struct blkcg *bio_blkcg(struct bio *bio) { return NULL; } | ||
366 | static inline struct blkcg_gq *blkg_lookup(struct blkcg *blkcg, void *key) { return NULL; } | 382 | static inline struct blkcg_gq *blkg_lookup(struct blkcg *blkcg, void *key) { return NULL; } |
367 | static inline int blkcg_init_queue(struct request_queue *q) { return 0; } | 383 | static inline int blkcg_init_queue(struct request_queue *q) { return 0; } |
368 | static inline void blkcg_drain_queue(struct request_queue *q) { } | 384 | static inline void blkcg_drain_queue(struct request_queue *q) { } |
@@ -374,6 +390,8 @@ static inline int blkcg_activate_policy(struct request_queue *q, | |||
374 | static inline void blkcg_deactivate_policy(struct request_queue *q, | 390 | static inline void blkcg_deactivate_policy(struct request_queue *q, |
375 | const struct blkcg_policy *pol) { } | 391 | const struct blkcg_policy *pol) { } |
376 | 392 | ||
393 | static inline struct blkcg *cgroup_to_blkcg(struct cgroup *cgroup) { return NULL; } | ||
394 | static inline struct blkcg *bio_blkcg(struct bio *bio) { return NULL; } | ||
377 | static inline struct blkg_policy_data *blkg_to_pd(struct blkcg_gq *blkg, | 395 | static inline struct blkg_policy_data *blkg_to_pd(struct blkcg_gq *blkg, |
378 | struct blkcg_policy *pol) { return NULL; } | 396 | struct blkcg_policy *pol) { return NULL; } |
379 | static inline struct blkcg_gq *pd_to_blkg(struct blkg_policy_data *pd) { return NULL; } | 397 | static inline struct blkcg_gq *pd_to_blkg(struct blkg_policy_data *pd) { return NULL; } |