Vivek Goyal | 31e4c28 | 2009-12-03 12:59:42 -0500 | [diff] [blame] | 1 | #ifndef _BLK_CGROUP_H |
| 2 | #define _BLK_CGROUP_H |
| 3 | /* |
| 4 | * Common Block IO controller cgroup interface |
| 5 | * |
| 6 | * Based on ideas and code from CFQ, CFS and BFQ: |
| 7 | * Copyright (C) 2003 Jens Axboe <axboe@kernel.dk> |
| 8 | * |
| 9 | * Copyright (C) 2008 Fabio Checconi <fabio@gandalf.sssup.it> |
| 10 | * Paolo Valente <paolo.valente@unimore.it> |
| 11 | * |
| 12 | * Copyright (C) 2009 Vivek Goyal <vgoyal@redhat.com> |
| 13 | * Nauman Rafique <nauman@google.com> |
| 14 | */ |
| 15 | |
| 16 | #include <linux/cgroup.h> |
Vivek Goyal | 575969a | 2011-05-19 15:38:29 -0400 | [diff] [blame] | 17 | #include <linux/u64_stats_sync.h> |
Tejun Heo | 829fdb5 | 2012-04-01 14:38:43 -0700 | [diff] [blame] | 18 | #include <linux/seq_file.h> |
Vivek Goyal | 31e4c28 | 2009-12-03 12:59:42 -0500 | [diff] [blame] | 19 | |
Vivek Goyal | 062a644 | 2010-09-15 17:06:33 -0400 | [diff] [blame] | 20 | enum blkio_policy_id { |
| 21 | BLKIO_POLICY_PROP = 0, /* Proportional Bandwidth division */ |
Vivek Goyal | 4c9eefa | 2010-09-15 17:06:34 -0400 | [diff] [blame] | 22 | BLKIO_POLICY_THROTL, /* Throttling */ |
Tejun Heo | 035d10b | 2012-03-05 13:15:04 -0800 | [diff] [blame] | 23 | |
| 24 | BLKIO_NR_POLICIES, |
Vivek Goyal | 062a644 | 2010-09-15 17:06:33 -0400 | [diff] [blame] | 25 | }; |
| 26 | |
Vivek Goyal | 9355aed | 2010-10-01 21:16:41 +0200 | [diff] [blame] | 27 | /* Max limits for throttle policy */ |
| 28 | #define THROTL_IOPS_MAX UINT_MAX |
| 29 | |
Tejun Heo | 32e380a | 2012-03-05 13:14:54 -0800 | [diff] [blame] | 30 | #ifdef CONFIG_BLK_CGROUP |
Jens Axboe | 2f5ea47 | 2009-12-03 21:06:43 +0100 | [diff] [blame] | 31 | |
Tejun Heo | 3381cb8 | 2012-04-01 14:38:44 -0700 | [diff] [blame] | 32 | /* CFQ specific, out here for blkcg->cfq_weight */ |
| 33 | #define CFQ_WEIGHT_MIN 10 |
| 34 | #define CFQ_WEIGHT_MAX 1000 |
| 35 | #define CFQ_WEIGHT_DEFAULT 500 |
| 36 | |
Tejun Heo | d3d32e69 | 2012-04-01 14:38:42 -0700 | [diff] [blame] | 37 | /* cft->private [un]packing for stat printing */ |
| 38 | #define BLKCG_STAT_PRIV(pol, off) (((unsigned)(pol) << 16) | (off)) |
| 39 | #define BLKCG_STAT_POL(prv) ((unsigned)(prv) >> 16) |
| 40 | #define BLKCG_STAT_OFF(prv) ((unsigned)(prv) & 0xffff) |
Tejun Heo | 2aa4a15 | 2012-04-01 14:38:42 -0700 | [diff] [blame] | 41 | |
Tejun Heo | edcb072 | 2012-04-01 14:38:42 -0700 | [diff] [blame] | 42 | enum blkg_rwstat_type { |
| 43 | BLKG_RWSTAT_READ, |
| 44 | BLKG_RWSTAT_WRITE, |
| 45 | BLKG_RWSTAT_SYNC, |
| 46 | BLKG_RWSTAT_ASYNC, |
| 47 | |
| 48 | BLKG_RWSTAT_NR, |
| 49 | BLKG_RWSTAT_TOTAL = BLKG_RWSTAT_NR, |
Divyesh Shah | 303a3ac | 2010-04-01 15:01:24 -0700 | [diff] [blame] | 50 | }; |
| 51 | |
Vivek Goyal | 31e4c28 | 2009-12-03 12:59:42 -0500 | [diff] [blame] | 52 | struct blkio_cgroup { |
| 53 | struct cgroup_subsys_state css; |
Vivek Goyal | 31e4c28 | 2009-12-03 12:59:42 -0500 | [diff] [blame] | 54 | spinlock_t lock; |
| 55 | struct hlist_head blkg_list; |
Tejun Heo | 9a9e8a2 | 2012-03-19 15:10:56 -0700 | [diff] [blame] | 56 | |
| 57 | /* for policies to test whether associated blkcg has changed */ |
| 58 | uint64_t id; |
Tejun Heo | 3381cb8 | 2012-04-01 14:38:44 -0700 | [diff] [blame] | 59 | |
| 60 | /* TODO: per-policy storage in blkio_cgroup */ |
| 61 | unsigned int cfq_weight; /* belongs to cfq */ |
Vivek Goyal | 31e4c28 | 2009-12-03 12:59:42 -0500 | [diff] [blame] | 62 | }; |
| 63 | |
Tejun Heo | edcb072 | 2012-04-01 14:38:42 -0700 | [diff] [blame] | 64 | struct blkg_stat { |
| 65 | struct u64_stats_sync syncp; |
| 66 | uint64_t cnt; |
| 67 | }; |
| 68 | |
| 69 | struct blkg_rwstat { |
| 70 | struct u64_stats_sync syncp; |
| 71 | uint64_t cnt[BLKG_RWSTAT_NR]; |
| 72 | }; |
| 73 | |
Tejun Heo | 0381411 | 2012-03-05 13:15:14 -0800 | [diff] [blame] | 74 | /* per-blkg per-policy data */ |
| 75 | struct blkg_policy_data { |
| 76 | /* the blkg this per-policy data belongs to */ |
| 77 | struct blkio_group *blkg; |
| 78 | |
| 79 | /* pol->pdata_size bytes of private data used by policy impl */ |
| 80 | char pdata[] __aligned(__alignof__(unsigned long long)); |
| 81 | }; |
| 82 | |
Vivek Goyal | 31e4c28 | 2009-12-03 12:59:42 -0500 | [diff] [blame] | 83 | struct blkio_group { |
Tejun Heo | c875f4d | 2012-03-05 13:15:22 -0800 | [diff] [blame] | 84 | /* Pointer to the associated request_queue */ |
| 85 | struct request_queue *q; |
Tejun Heo | e8989fa | 2012-03-05 13:15:20 -0800 | [diff] [blame] | 86 | struct list_head q_node; |
Vivek Goyal | 31e4c28 | 2009-12-03 12:59:42 -0500 | [diff] [blame] | 87 | struct hlist_node blkcg_node; |
Tejun Heo | 7ee9c56 | 2012-03-05 13:15:11 -0800 | [diff] [blame] | 88 | struct blkio_cgroup *blkcg; |
Vivek Goyal | 2868ef7 | 2009-12-03 12:59:48 -0500 | [diff] [blame] | 89 | /* Store cgroup path */ |
| 90 | char path[128]; |
Tejun Heo | 1adaf3d | 2012-03-05 13:15:15 -0800 | [diff] [blame] | 91 | /* reference count */ |
| 92 | int refcnt; |
Vivek Goyal | 2208419 | 2009-12-03 12:59:49 -0500 | [diff] [blame] | 93 | |
Tejun Heo | 549d3aa | 2012-03-05 13:15:16 -0800 | [diff] [blame] | 94 | struct blkg_policy_data *pd[BLKIO_NR_POLICIES]; |
Tejun Heo | 1adaf3d | 2012-03-05 13:15:15 -0800 | [diff] [blame] | 95 | |
| 96 | struct rcu_head rcu_head; |
Vivek Goyal | 31e4c28 | 2009-12-03 12:59:42 -0500 | [diff] [blame] | 97 | }; |
| 98 | |
Tejun Heo | 0381411 | 2012-03-05 13:15:14 -0800 | [diff] [blame] | 99 | typedef void (blkio_init_group_fn)(struct blkio_group *blkg); |
Tejun Heo | 9ade5ea | 2012-04-01 14:38:44 -0700 | [diff] [blame] | 100 | typedef void (blkio_exit_group_fn)(struct blkio_group *blkg); |
| 101 | typedef void (blkio_reset_group_stats_fn)(struct blkio_group *blkg); |
Vivek Goyal | 3e25206 | 2009-12-04 10:36:42 -0500 | [diff] [blame] | 102 | |
| 103 | struct blkio_policy_ops { |
Tejun Heo | 0381411 | 2012-03-05 13:15:14 -0800 | [diff] [blame] | 104 | blkio_init_group_fn *blkio_init_group_fn; |
Tejun Heo | 9ade5ea | 2012-04-01 14:38:44 -0700 | [diff] [blame] | 105 | blkio_exit_group_fn *blkio_exit_group_fn; |
| 106 | blkio_reset_group_stats_fn *blkio_reset_group_stats_fn; |
Vivek Goyal | 3e25206 | 2009-12-04 10:36:42 -0500 | [diff] [blame] | 107 | }; |
| 108 | |
| 109 | struct blkio_policy_type { |
| 110 | struct list_head list; |
| 111 | struct blkio_policy_ops ops; |
Vivek Goyal | 062a644 | 2010-09-15 17:06:33 -0400 | [diff] [blame] | 112 | enum blkio_policy_id plid; |
Tejun Heo | 0381411 | 2012-03-05 13:15:14 -0800 | [diff] [blame] | 113 | size_t pdata_size; /* policy specific private data size */ |
Tejun Heo | 44ea53d | 2012-04-01 14:38:43 -0700 | [diff] [blame] | 114 | struct cftype *cftypes; /* cgroup files for the policy */ |
Vivek Goyal | 3e25206 | 2009-12-04 10:36:42 -0500 | [diff] [blame] | 115 | }; |
| 116 | |
Tejun Heo | 5efd611 | 2012-03-05 13:15:12 -0800 | [diff] [blame] | 117 | extern int blkcg_init_queue(struct request_queue *q); |
| 118 | extern void blkcg_drain_queue(struct request_queue *q); |
| 119 | extern void blkcg_exit_queue(struct request_queue *q); |
| 120 | |
Vivek Goyal | 3e25206 | 2009-12-04 10:36:42 -0500 | [diff] [blame] | 121 | /* Blkio controller policy registration */ |
| 122 | extern void blkio_policy_register(struct blkio_policy_type *); |
| 123 | extern void blkio_policy_unregister(struct blkio_policy_type *); |
Tejun Heo | e8989fa | 2012-03-05 13:15:20 -0800 | [diff] [blame] | 124 | extern void blkg_destroy_all(struct request_queue *q, bool destroy_root); |
| 125 | extern void update_root_blkg_pd(struct request_queue *q, |
| 126 | enum blkio_policy_id plid); |
Vivek Goyal | 3e25206 | 2009-12-04 10:36:42 -0500 | [diff] [blame] | 127 | |
Tejun Heo | 829fdb5 | 2012-04-01 14:38:43 -0700 | [diff] [blame] | 128 | void blkcg_print_blkgs(struct seq_file *sf, struct blkio_cgroup *blkcg, |
Tejun Heo | d366e7e | 2012-04-01 14:38:44 -0700 | [diff] [blame^] | 129 | u64 (*prfill)(struct seq_file *, void *, int), |
Tejun Heo | 829fdb5 | 2012-04-01 14:38:43 -0700 | [diff] [blame] | 130 | int pol, int data, bool show_total); |
Tejun Heo | d366e7e | 2012-04-01 14:38:44 -0700 | [diff] [blame^] | 131 | u64 __blkg_prfill_u64(struct seq_file *sf, void *pdata, u64 v); |
| 132 | u64 __blkg_prfill_rwstat(struct seq_file *sf, void *pdata, |
Tejun Heo | 829fdb5 | 2012-04-01 14:38:43 -0700 | [diff] [blame] | 133 | const struct blkg_rwstat *rwstat); |
| 134 | int blkcg_print_stat(struct cgroup *cgrp, struct cftype *cft, |
| 135 | struct seq_file *sf); |
| 136 | int blkcg_print_rwstat(struct cgroup *cgrp, struct cftype *cft, |
| 137 | struct seq_file *sf); |
Tejun Heo | 829fdb5 | 2012-04-01 14:38:43 -0700 | [diff] [blame] | 138 | |
| 139 | struct blkg_conf_ctx { |
| 140 | struct gendisk *disk; |
| 141 | struct blkio_group *blkg; |
| 142 | u64 v; |
| 143 | }; |
| 144 | |
| 145 | int blkg_conf_prep(struct blkio_cgroup *blkcg, const char *input, |
| 146 | struct blkg_conf_ctx *ctx); |
| 147 | void blkg_conf_finish(struct blkg_conf_ctx *ctx); |
| 148 | |
| 149 | |
Tejun Heo | 0381411 | 2012-03-05 13:15:14 -0800 | [diff] [blame] | 150 | /** |
| 151 | * blkg_to_pdata - get policy private data |
| 152 | * @blkg: blkg of interest |
| 153 | * @pol: policy of interest |
| 154 | * |
| 155 | * Return pointer to private data associated with the @blkg-@pol pair. |
| 156 | */ |
| 157 | static inline void *blkg_to_pdata(struct blkio_group *blkg, |
| 158 | struct blkio_policy_type *pol) |
| 159 | { |
Tejun Heo | 549d3aa | 2012-03-05 13:15:16 -0800 | [diff] [blame] | 160 | return blkg ? blkg->pd[pol->plid]->pdata : NULL; |
Tejun Heo | 0381411 | 2012-03-05 13:15:14 -0800 | [diff] [blame] | 161 | } |
| 162 | |
| 163 | /** |
| 164 | * pdata_to_blkg - get blkg associated with policy private data |
| 165 | * @pdata: policy private data of interest |
Tejun Heo | 0381411 | 2012-03-05 13:15:14 -0800 | [diff] [blame] | 166 | * |
Tejun Heo | aaec55a | 2012-04-01 14:38:42 -0700 | [diff] [blame] | 167 | * @pdata is policy private data. Determine the blkg it's associated with. |
Tejun Heo | 0381411 | 2012-03-05 13:15:14 -0800 | [diff] [blame] | 168 | */ |
Tejun Heo | aaec55a | 2012-04-01 14:38:42 -0700 | [diff] [blame] | 169 | static inline struct blkio_group *pdata_to_blkg(void *pdata) |
Tejun Heo | 0381411 | 2012-03-05 13:15:14 -0800 | [diff] [blame] | 170 | { |
| 171 | if (pdata) { |
| 172 | struct blkg_policy_data *pd = |
| 173 | container_of(pdata, struct blkg_policy_data, pdata); |
| 174 | return pd->blkg; |
| 175 | } |
| 176 | return NULL; |
| 177 | } |
| 178 | |
Vivek Goyal | afc24d4 | 2010-04-26 19:27:56 +0200 | [diff] [blame] | 179 | static inline char *blkg_path(struct blkio_group *blkg) |
| 180 | { |
| 181 | return blkg->path; |
| 182 | } |
| 183 | |
Tejun Heo | 1adaf3d | 2012-03-05 13:15:15 -0800 | [diff] [blame] | 184 | /** |
| 185 | * blkg_get - get a blkg reference |
| 186 | * @blkg: blkg to get |
| 187 | * |
| 188 | * The caller should be holding queue_lock and an existing reference. |
| 189 | */ |
| 190 | static inline void blkg_get(struct blkio_group *blkg) |
| 191 | { |
| 192 | lockdep_assert_held(blkg->q->queue_lock); |
| 193 | WARN_ON_ONCE(!blkg->refcnt); |
| 194 | blkg->refcnt++; |
| 195 | } |
| 196 | |
| 197 | void __blkg_release(struct blkio_group *blkg); |
| 198 | |
| 199 | /** |
| 200 | * blkg_put - put a blkg reference |
| 201 | * @blkg: blkg to put |
| 202 | * |
| 203 | * The caller should be holding queue_lock. |
| 204 | */ |
| 205 | static inline void blkg_put(struct blkio_group *blkg) |
| 206 | { |
| 207 | lockdep_assert_held(blkg->q->queue_lock); |
| 208 | WARN_ON_ONCE(blkg->refcnt <= 0); |
| 209 | if (!--blkg->refcnt) |
| 210 | __blkg_release(blkg); |
| 211 | } |
| 212 | |
Tejun Heo | edcb072 | 2012-04-01 14:38:42 -0700 | [diff] [blame] | 213 | /** |
| 214 | * blkg_stat_add - add a value to a blkg_stat |
| 215 | * @stat: target blkg_stat |
| 216 | * @val: value to add |
| 217 | * |
| 218 | * Add @val to @stat. The caller is responsible for synchronizing calls to |
| 219 | * this function. |
| 220 | */ |
| 221 | static inline void blkg_stat_add(struct blkg_stat *stat, uint64_t val) |
| 222 | { |
| 223 | u64_stats_update_begin(&stat->syncp); |
| 224 | stat->cnt += val; |
| 225 | u64_stats_update_end(&stat->syncp); |
| 226 | } |
| 227 | |
| 228 | /** |
| 229 | * blkg_stat_read - read the current value of a blkg_stat |
| 230 | * @stat: blkg_stat to read |
| 231 | * |
| 232 | * Read the current value of @stat. This function can be called without |
| 233 | * synchroniztion and takes care of u64 atomicity. |
| 234 | */ |
| 235 | static inline uint64_t blkg_stat_read(struct blkg_stat *stat) |
| 236 | { |
| 237 | unsigned int start; |
| 238 | uint64_t v; |
| 239 | |
| 240 | do { |
| 241 | start = u64_stats_fetch_begin(&stat->syncp); |
| 242 | v = stat->cnt; |
| 243 | } while (u64_stats_fetch_retry(&stat->syncp, start)); |
| 244 | |
| 245 | return v; |
| 246 | } |
| 247 | |
| 248 | /** |
| 249 | * blkg_stat_reset - reset a blkg_stat |
| 250 | * @stat: blkg_stat to reset |
| 251 | */ |
| 252 | static inline void blkg_stat_reset(struct blkg_stat *stat) |
| 253 | { |
| 254 | stat->cnt = 0; |
| 255 | } |
| 256 | |
| 257 | /** |
| 258 | * blkg_rwstat_add - add a value to a blkg_rwstat |
| 259 | * @rwstat: target blkg_rwstat |
| 260 | * @rw: mask of REQ_{WRITE|SYNC} |
| 261 | * @val: value to add |
| 262 | * |
| 263 | * Add @val to @rwstat. The counters are chosen according to @rw. The |
| 264 | * caller is responsible for synchronizing calls to this function. |
| 265 | */ |
| 266 | static inline void blkg_rwstat_add(struct blkg_rwstat *rwstat, |
| 267 | int rw, uint64_t val) |
| 268 | { |
| 269 | u64_stats_update_begin(&rwstat->syncp); |
| 270 | |
| 271 | if (rw & REQ_WRITE) |
| 272 | rwstat->cnt[BLKG_RWSTAT_WRITE] += val; |
| 273 | else |
| 274 | rwstat->cnt[BLKG_RWSTAT_READ] += val; |
| 275 | if (rw & REQ_SYNC) |
| 276 | rwstat->cnt[BLKG_RWSTAT_SYNC] += val; |
| 277 | else |
| 278 | rwstat->cnt[BLKG_RWSTAT_ASYNC] += val; |
| 279 | |
| 280 | u64_stats_update_end(&rwstat->syncp); |
| 281 | } |
| 282 | |
| 283 | /** |
| 284 | * blkg_rwstat_read - read the current values of a blkg_rwstat |
| 285 | * @rwstat: blkg_rwstat to read |
| 286 | * |
| 287 | * Read the current snapshot of @rwstat and return it as the return value. |
| 288 | * This function can be called without synchronization and takes care of |
| 289 | * u64 atomicity. |
| 290 | */ |
| 291 | static struct blkg_rwstat blkg_rwstat_read(struct blkg_rwstat *rwstat) |
| 292 | { |
| 293 | unsigned int start; |
| 294 | struct blkg_rwstat tmp; |
| 295 | |
| 296 | do { |
| 297 | start = u64_stats_fetch_begin(&rwstat->syncp); |
| 298 | tmp = *rwstat; |
| 299 | } while (u64_stats_fetch_retry(&rwstat->syncp, start)); |
| 300 | |
| 301 | return tmp; |
| 302 | } |
| 303 | |
| 304 | /** |
| 305 | * blkg_rwstat_sum - read the total count of a blkg_rwstat |
| 306 | * @rwstat: blkg_rwstat to read |
| 307 | * |
| 308 | * Return the total count of @rwstat regardless of the IO direction. This |
| 309 | * function can be called without synchronization and takes care of u64 |
| 310 | * atomicity. |
| 311 | */ |
| 312 | static inline uint64_t blkg_rwstat_sum(struct blkg_rwstat *rwstat) |
| 313 | { |
| 314 | struct blkg_rwstat tmp = blkg_rwstat_read(rwstat); |
| 315 | |
| 316 | return tmp.cnt[BLKG_RWSTAT_READ] + tmp.cnt[BLKG_RWSTAT_WRITE]; |
| 317 | } |
| 318 | |
| 319 | /** |
| 320 | * blkg_rwstat_reset - reset a blkg_rwstat |
| 321 | * @rwstat: blkg_rwstat to reset |
| 322 | */ |
| 323 | static inline void blkg_rwstat_reset(struct blkg_rwstat *rwstat) |
| 324 | { |
| 325 | memset(rwstat->cnt, 0, sizeof(rwstat->cnt)); |
| 326 | } |
| 327 | |
Jens Axboe | 2f5ea47 | 2009-12-03 21:06:43 +0100 | [diff] [blame] | 328 | #else |
| 329 | |
| 330 | struct blkio_group { |
| 331 | }; |
| 332 | |
Vivek Goyal | 3e25206 | 2009-12-04 10:36:42 -0500 | [diff] [blame] | 333 | struct blkio_policy_type { |
| 334 | }; |
| 335 | |
Tejun Heo | 5efd611 | 2012-03-05 13:15:12 -0800 | [diff] [blame] | 336 | static inline int blkcg_init_queue(struct request_queue *q) { return 0; } |
| 337 | static inline void blkcg_drain_queue(struct request_queue *q) { } |
| 338 | static inline void blkcg_exit_queue(struct request_queue *q) { } |
Vivek Goyal | 3e25206 | 2009-12-04 10:36:42 -0500 | [diff] [blame] | 339 | static inline void blkio_policy_register(struct blkio_policy_type *blkiop) { } |
| 340 | static inline void blkio_policy_unregister(struct blkio_policy_type *blkiop) { } |
Tejun Heo | 03aa264a | 2012-03-05 13:15:19 -0800 | [diff] [blame] | 341 | static inline void blkg_destroy_all(struct request_queue *q, |
Tejun Heo | 03aa264a | 2012-03-05 13:15:19 -0800 | [diff] [blame] | 342 | bool destory_root) { } |
Tejun Heo | e8989fa | 2012-03-05 13:15:20 -0800 | [diff] [blame] | 343 | static inline void update_root_blkg_pd(struct request_queue *q, |
| 344 | enum blkio_policy_id plid) { } |
Vivek Goyal | 3e25206 | 2009-12-04 10:36:42 -0500 | [diff] [blame] | 345 | |
Tejun Heo | 0381411 | 2012-03-05 13:15:14 -0800 | [diff] [blame] | 346 | static inline void *blkg_to_pdata(struct blkio_group *blkg, |
| 347 | struct blkio_policy_type *pol) { return NULL; } |
| 348 | static inline struct blkio_group *pdata_to_blkg(void *pdata, |
| 349 | struct blkio_policy_type *pol) { return NULL; } |
Vivek Goyal | afc24d4 | 2010-04-26 19:27:56 +0200 | [diff] [blame] | 350 | static inline char *blkg_path(struct blkio_group *blkg) { return NULL; } |
Tejun Heo | 1adaf3d | 2012-03-05 13:15:15 -0800 | [diff] [blame] | 351 | static inline void blkg_get(struct blkio_group *blkg) { } |
| 352 | static inline void blkg_put(struct blkio_group *blkg) { } |
Vivek Goyal | afc24d4 | 2010-04-26 19:27:56 +0200 | [diff] [blame] | 353 | |
Jens Axboe | 2f5ea47 | 2009-12-03 21:06:43 +0100 | [diff] [blame] | 354 | #endif |
| 355 | |
Tejun Heo | 32e380a | 2012-03-05 13:14:54 -0800 | [diff] [blame] | 356 | #ifdef CONFIG_BLK_CGROUP |
Vivek Goyal | 31e4c28 | 2009-12-03 12:59:42 -0500 | [diff] [blame] | 357 | extern struct blkio_cgroup blkio_root_cgroup; |
| 358 | extern struct blkio_cgroup *cgroup_to_blkio_cgroup(struct cgroup *cgroup); |
Tejun Heo | 4f85cb9 | 2012-03-05 13:15:28 -0800 | [diff] [blame] | 359 | extern struct blkio_cgroup *bio_blkio_cgroup(struct bio *bio); |
Tejun Heo | cd1604f | 2012-03-05 13:15:06 -0800 | [diff] [blame] | 360 | extern struct blkio_group *blkg_lookup(struct blkio_cgroup *blkcg, |
Tejun Heo | e8989fa | 2012-03-05 13:15:20 -0800 | [diff] [blame] | 361 | struct request_queue *q); |
Tejun Heo | cd1604f | 2012-03-05 13:15:06 -0800 | [diff] [blame] | 362 | struct blkio_group *blkg_lookup_create(struct blkio_cgroup *blkcg, |
| 363 | struct request_queue *q, |
Tejun Heo | cd1604f | 2012-03-05 13:15:06 -0800 | [diff] [blame] | 364 | bool for_root); |
Vivek Goyal | 31e4c28 | 2009-12-03 12:59:42 -0500 | [diff] [blame] | 365 | #else |
Jens Axboe | 2f5ea47 | 2009-12-03 21:06:43 +0100 | [diff] [blame] | 366 | struct cgroup; |
Vivek Goyal | 31e4c28 | 2009-12-03 12:59:42 -0500 | [diff] [blame] | 367 | static inline struct blkio_cgroup * |
| 368 | cgroup_to_blkio_cgroup(struct cgroup *cgroup) { return NULL; } |
Vivek Goyal | 70087dc | 2011-05-16 15:24:08 +0200 | [diff] [blame] | 369 | static inline struct blkio_cgroup * |
Tejun Heo | 4f85cb9 | 2012-03-05 13:15:28 -0800 | [diff] [blame] | 370 | bio_blkio_cgroup(struct bio *bio) { return NULL; } |
Vivek Goyal | 31e4c28 | 2009-12-03 12:59:42 -0500 | [diff] [blame] | 371 | |
Tejun Heo | cd1604f | 2012-03-05 13:15:06 -0800 | [diff] [blame] | 372 | static inline struct blkio_group *blkg_lookup(struct blkio_cgroup *blkcg, |
| 373 | void *key) { return NULL; } |
Vivek Goyal | 31e4c28 | 2009-12-03 12:59:42 -0500 | [diff] [blame] | 374 | #endif |
| 375 | #endif /* _BLK_CGROUP_H */ |