diff options
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-cgroup.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h index 628e50f6f8a8..8e5863e900bf 100644 --- a/block/blk-cgroup.h +++ b/block/blk-cgroup.h | |||
@@ -179,21 +179,25 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol, | |||
179 | void blkg_conf_finish(struct blkg_conf_ctx *ctx); | 179 | void blkg_conf_finish(struct blkg_conf_ctx *ctx); |
180 | 180 | ||
181 | 181 | ||
182 | static inline struct blkcg *css_to_blkcg(struct cgroup_subsys_state *css) | ||
183 | { | ||
184 | return css ? container_of(css, struct blkcg, css) : NULL; | ||
185 | } | ||
186 | |||
182 | static inline struct blkcg *cgroup_to_blkcg(struct cgroup *cgroup) | 187 | static inline struct blkcg *cgroup_to_blkcg(struct cgroup *cgroup) |
183 | { | 188 | { |
184 | return container_of(cgroup_css(cgroup, blkio_subsys_id), | 189 | return css_to_blkcg(cgroup_css(cgroup, blkio_subsys_id)); |
185 | struct blkcg, css); | ||
186 | } | 190 | } |
187 | 191 | ||
188 | static inline struct blkcg *task_blkcg(struct task_struct *tsk) | 192 | static inline struct blkcg *task_blkcg(struct task_struct *tsk) |
189 | { | 193 | { |
190 | return container_of(task_css(tsk, blkio_subsys_id), struct blkcg, css); | 194 | return css_to_blkcg(task_css(tsk, blkio_subsys_id)); |
191 | } | 195 | } |
192 | 196 | ||
193 | static inline struct blkcg *bio_blkcg(struct bio *bio) | 197 | static inline struct blkcg *bio_blkcg(struct bio *bio) |
194 | { | 198 | { |
195 | if (bio && bio->bi_css) | 199 | if (bio && bio->bi_css) |
196 | return container_of(bio->bi_css, struct blkcg, css); | 200 | return css_to_blkcg(bio->bi_css); |
197 | return task_blkcg(current); | 201 | return task_blkcg(current); |
198 | } | 202 | } |
199 | 203 | ||