aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-cgroup.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2012-04-13 16:11:28 -0400
committerJens Axboe <axboe@kernel.dk>2012-04-20 04:06:06 -0400
commit8bd435b30ecacb69bbb8b2d3e251f770b807c5b2 (patch)
treea1a50e95517a54a578af3967fb4016a5a1a42a68 /block/blk-cgroup.h
parentec399347d39fb2337ebace928cf4a2855bd0ec37 (diff)
blkcg: remove static policy ID enums
Remove BLKIO_POLICY_* enums and let blkio_policy_register() allocate @pol->plid dynamically on registration. The maximum number of blkcg policies which can be registered at the same time is defined by BLKCG_MAX_POLS constant added to include/linux/blkdev.h. Note that blkio_policy_register() now may fail. Policy init functions updated accordingly and unnecessary ifdefs removed from cfq_init(). 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.h')
-rw-r--r--block/blk-cgroup.h15
1 files changed, 4 insertions, 11 deletions
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h
index 26949731108f..be80d6eb6531 100644
--- a/block/blk-cgroup.h
+++ b/block/blk-cgroup.h
@@ -17,13 +17,6 @@
17#include <linux/u64_stats_sync.h> 17#include <linux/u64_stats_sync.h>
18#include <linux/seq_file.h> 18#include <linux/seq_file.h>
19 19
20enum blkio_policy_id {
21 BLKIO_POLICY_PROP = 0, /* Proportional Bandwidth division */
22 BLKIO_POLICY_THROTL, /* Throttling */
23
24 BLKIO_NR_POLICIES,
25};
26
27/* Max limits for throttle policy */ 20/* Max limits for throttle policy */
28#define THROTL_IOPS_MAX UINT_MAX 21#define THROTL_IOPS_MAX UINT_MAX
29 22
@@ -86,7 +79,7 @@ struct blkio_group {
86 /* reference count */ 79 /* reference count */
87 int refcnt; 80 int refcnt;
88 81
89 struct blkg_policy_data *pd[BLKIO_NR_POLICIES]; 82 struct blkg_policy_data *pd[BLKCG_MAX_POLS];
90 83
91 struct rcu_head rcu_head; 84 struct rcu_head rcu_head;
92}; 85};
@@ -103,7 +96,7 @@ struct blkio_policy_ops {
103 96
104struct blkio_policy_type { 97struct blkio_policy_type {
105 struct blkio_policy_ops ops; 98 struct blkio_policy_ops ops;
106 enum blkio_policy_id plid; 99 int plid;
107 size_t pdata_size; /* policy specific private data size */ 100 size_t pdata_size; /* policy specific private data size */
108 struct cftype *cftypes; /* cgroup files for the policy */ 101 struct cftype *cftypes; /* cgroup files for the policy */
109}; 102};
@@ -113,7 +106,7 @@ extern void blkcg_drain_queue(struct request_queue *q);
113extern void blkcg_exit_queue(struct request_queue *q); 106extern void blkcg_exit_queue(struct request_queue *q);
114 107
115/* Blkio controller policy registration */ 108/* Blkio controller policy registration */
116extern void blkio_policy_register(struct blkio_policy_type *); 109extern int blkio_policy_register(struct blkio_policy_type *);
117extern void blkio_policy_unregister(struct blkio_policy_type *); 110extern void blkio_policy_unregister(struct blkio_policy_type *);
118extern void blkg_destroy_all(struct request_queue *q, bool destroy_root); 111extern void blkg_destroy_all(struct request_queue *q, bool destroy_root);
119extern void update_root_blkg_pd(struct request_queue *q, 112extern void update_root_blkg_pd(struct request_queue *q,
@@ -329,7 +322,7 @@ struct blkio_policy_type {
329static inline int blkcg_init_queue(struct request_queue *q) { return 0; } 322static inline int blkcg_init_queue(struct request_queue *q) { return 0; }
330static inline void blkcg_drain_queue(struct request_queue *q) { } 323static inline void blkcg_drain_queue(struct request_queue *q) { }
331static inline void blkcg_exit_queue(struct request_queue *q) { } 324static inline void blkcg_exit_queue(struct request_queue *q) { }
332static inline void blkio_policy_register(struct blkio_policy_type *blkiop) { } 325static inline int blkio_policy_register(struct blkio_policy_type *blkiop) { return 0; }
333static inline void blkio_policy_unregister(struct blkio_policy_type *blkiop) { } 326static inline void blkio_policy_unregister(struct blkio_policy_type *blkiop) { }
334static inline void blkg_destroy_all(struct request_queue *q, 327static inline void blkg_destroy_all(struct request_queue *q,
335 bool destory_root) { } 328 bool destory_root) { }