aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-cgroup.h
diff options
context:
space:
mode:
authorVivek Goyal <vgoyal@redhat.com>2010-09-15 17:06:33 -0400
committerJens Axboe <jaxboe@fusionio.com>2010-09-16 02:42:04 -0400
commit062a644d6121d5e2f51c0b2ca0cbc5155ebf845b (patch)
tree250626a8ee11efa8e598692904e12ac26c29cab5 /block/blk-cgroup.h
parentaf41d7bd9b685ab4e8f930627874ba4f4728e128 (diff)
blk-cgroup: Prepare the base for supporting more than one IO control policies
o This patch prepares the base for introducing new IO control policies. Currently all the code is written knowing there is only one policy and that is proportional bandwidth. Creating infrastructure for newer policies to come in. o Also there were many functions which were generated using macro. It was very confusing. Got rid of those. Signed-off-by: Vivek Goyal <vgoyal@redhat.com> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'block/blk-cgroup.h')
-rw-r--r--block/blk-cgroup.h36
1 files changed, 34 insertions, 2 deletions
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h
index 2b866ec1dce..c8de2598429 100644
--- a/block/blk-cgroup.h
+++ b/block/blk-cgroup.h
@@ -15,6 +15,10 @@
15 15
16#include <linux/cgroup.h> 16#include <linux/cgroup.h>
17 17
18enum blkio_policy_id {
19 BLKIO_POLICY_PROP = 0, /* Proportional Bandwidth division */
20};
21
18#if defined(CONFIG_BLK_CGROUP) || defined(CONFIG_BLK_CGROUP_MODULE) 22#if defined(CONFIG_BLK_CGROUP) || defined(CONFIG_BLK_CGROUP_MODULE)
19 23
20#ifndef CONFIG_BLK_CGROUP 24#ifndef CONFIG_BLK_CGROUP
@@ -65,6 +69,25 @@ enum blkg_state_flags {
65 BLKG_empty, 69 BLKG_empty,
66}; 70};
67 71
72/* cgroup files owned by proportional weight policy */
73enum blkcg_file_name_prop {
74 BLKIO_PROP_weight = 1,
75 BLKIO_PROP_weight_device,
76 BLKIO_PROP_io_service_bytes,
77 BLKIO_PROP_io_serviced,
78 BLKIO_PROP_time,
79 BLKIO_PROP_sectors,
80 BLKIO_PROP_io_service_time,
81 BLKIO_PROP_io_wait_time,
82 BLKIO_PROP_io_merged,
83 BLKIO_PROP_io_queued,
84 BLKIO_PROP_avg_queue_size,
85 BLKIO_PROP_group_wait_time,
86 BLKIO_PROP_idle_time,
87 BLKIO_PROP_empty_time,
88 BLKIO_PROP_dequeue,
89};
90
68struct blkio_cgroup { 91struct blkio_cgroup {
69 struct cgroup_subsys_state css; 92 struct cgroup_subsys_state css;
70 unsigned int weight; 93 unsigned int weight;
@@ -112,6 +135,8 @@ struct blkio_group {
112 char path[128]; 135 char path[128];
113 /* The device MKDEV(major, minor), this group has been created for */ 136 /* The device MKDEV(major, minor), this group has been created for */
114 dev_t dev; 137 dev_t dev;
138 /* policy which owns this blk group */
139 enum blkio_policy_id plid;
115 140
116 /* Need to serialize the stats in the case of reset/update */ 141 /* Need to serialize the stats in the case of reset/update */
117 spinlock_t stats_lock; 142 spinlock_t stats_lock;
@@ -122,6 +147,10 @@ struct blkio_policy_node {
122 struct list_head node; 147 struct list_head node;
123 dev_t dev; 148 dev_t dev;
124 unsigned int weight; 149 unsigned int weight;
150 /* This node belongs to max bw policy or porportional weight policy */
151 enum blkio_policy_id plid;
152 /* cgroup file to which this rule belongs to */
153 int fileid;
125}; 154};
126 155
127extern unsigned int blkcg_get_weight(struct blkio_cgroup *blkcg, 156extern unsigned int blkcg_get_weight(struct blkio_cgroup *blkcg,
@@ -139,6 +168,7 @@ struct blkio_policy_ops {
139struct blkio_policy_type { 168struct blkio_policy_type {
140 struct list_head list; 169 struct list_head list;
141 struct blkio_policy_ops ops; 170 struct blkio_policy_ops ops;
171 enum blkio_policy_id plid;
142}; 172};
143 173
144/* Blkio controller policy registration */ 174/* Blkio controller policy registration */
@@ -212,7 +242,8 @@ static inline void blkiocg_set_start_empty_time(struct blkio_group *blkg) {}
212extern struct blkio_cgroup blkio_root_cgroup; 242extern struct blkio_cgroup blkio_root_cgroup;
213extern struct blkio_cgroup *cgroup_to_blkio_cgroup(struct cgroup *cgroup); 243extern struct blkio_cgroup *cgroup_to_blkio_cgroup(struct cgroup *cgroup);
214extern void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg, 244extern void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg,
215 struct blkio_group *blkg, void *key, dev_t dev); 245 struct blkio_group *blkg, void *key, dev_t dev,
246 enum blkio_policy_id plid);
216extern int blkiocg_del_blkio_group(struct blkio_group *blkg); 247extern int blkiocg_del_blkio_group(struct blkio_group *blkg);
217extern struct blkio_group *blkiocg_lookup_group(struct blkio_cgroup *blkcg, 248extern struct blkio_group *blkiocg_lookup_group(struct blkio_cgroup *blkcg,
218 void *key); 249 void *key);
@@ -234,7 +265,8 @@ static inline struct blkio_cgroup *
234cgroup_to_blkio_cgroup(struct cgroup *cgroup) { return NULL; } 265cgroup_to_blkio_cgroup(struct cgroup *cgroup) { return NULL; }
235 266
236static inline void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg, 267static inline void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg,
237 struct blkio_group *blkg, void *key, dev_t dev) {} 268 struct blkio_group *blkg, void *key, dev_t dev,
269 enum blkio_policy_id plid) {}
238 270
239static inline int 271static inline int
240blkiocg_del_blkio_group(struct blkio_group *blkg) { return 0; } 272blkiocg_del_blkio_group(struct blkio_group *blkg) { return 0; }