summaryrefslogtreecommitdiffstats
path: root/block/blk-cgroup.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2012-04-13 13:11:28 -0700
committerJens Axboe <axboe@kernel.dk>2012-04-20 10:06:06 +0200
commit8bd435b30ecacb69bbb8b2d3e251f770b807c5b2 (patch)
treea1a50e95517a54a578af3967fb4016a5a1a42a68 /block/blk-cgroup.h
parentec399347d39fb2337ebace928cf4a2855bd0ec37 (diff)
downloadlinux-8bd435b30ecacb69bbb8b2d3e251f770b807c5b2.tar.gz
linux-8bd435b30ecacb69bbb8b2d3e251f770b807c5b2.tar.bz2
linux-8bd435b30ecacb69bbb8b2d3e251f770b807c5b2.zip
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 @@
#include <linux/u64_stats_sync.h>
#include <linux/seq_file.h>
-enum blkio_policy_id {
- BLKIO_POLICY_PROP = 0, /* Proportional Bandwidth division */
- BLKIO_POLICY_THROTL, /* Throttling */
-
- BLKIO_NR_POLICIES,
-};
-
/* Max limits for throttle policy */
#define THROTL_IOPS_MAX UINT_MAX
@@ -86,7 +79,7 @@ struct blkio_group {
/* reference count */
int refcnt;
- struct blkg_policy_data *pd[BLKIO_NR_POLICIES];
+ struct blkg_policy_data *pd[BLKCG_MAX_POLS];
struct rcu_head rcu_head;
};
@@ -103,7 +96,7 @@ struct blkio_policy_ops {
struct blkio_policy_type {
struct blkio_policy_ops ops;
- enum blkio_policy_id plid;
+ int plid;
size_t pdata_size; /* policy specific private data size */
struct cftype *cftypes; /* cgroup files for the policy */
};
@@ -113,7 +106,7 @@ extern void blkcg_drain_queue(struct request_queue *q);
extern void blkcg_exit_queue(struct request_queue *q);
/* Blkio controller policy registration */
-extern void blkio_policy_register(struct blkio_policy_type *);
+extern int blkio_policy_register(struct blkio_policy_type *);
extern void blkio_policy_unregister(struct blkio_policy_type *);
extern void blkg_destroy_all(struct request_queue *q, bool destroy_root);
extern void update_root_blkg_pd(struct request_queue *q,
@@ -329,7 +322,7 @@ struct blkio_policy_type {
static inline int blkcg_init_queue(struct request_queue *q) { return 0; }
static inline void blkcg_drain_queue(struct request_queue *q) { }
static inline void blkcg_exit_queue(struct request_queue *q) { }
-static inline void blkio_policy_register(struct blkio_policy_type *blkiop) { }
+static inline int blkio_policy_register(struct blkio_policy_type *blkiop) { return 0; }
static inline void blkio_policy_unregister(struct blkio_policy_type *blkiop) { }
static inline void blkg_destroy_all(struct request_queue *q,
bool destory_root) { }