diff options
author | Tejun Heo <tj@kernel.org> | 2012-03-05 16:15:19 -0500 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2012-03-06 15:27:23 -0500 |
commit | 03aa264ac15637b6f98374270bcdf31400965505 (patch) | |
tree | 6fa9ca54d3f775fba19123790f6655158034a1d8 /block/blk-cgroup.h | |
parent | 4eef3049986e8397d5003916aed8cad6567a5e02 (diff) |
blkcg: let blkcg core manage per-queue blkg list and counter
With the previous patch to move blkg list heads and counters to
request_queue and blkg, logic to manage them in both policies are
almost identical and can be moved to blkcg core.
This patch moves blkg link logic into blkg_lookup_create(), implements
common blkg unlink code in blkg_destroy(), and updates
blkg_destory_all() so that it's policy specific and can skip root
group. The updated blkg_destroy_all() is now used to both clear queue
for bypassing and elv switching, and release all blkgs on q exit.
This patch introduces a race window where policy [de]registration may
race against queue blkg clearing. This can only be a problem on cfq
unload and shouldn't be a real problem in practice (and we have many
other places where this race already exists). Future patches will
remove these unlikely races.
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.h | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h index ae96f196d469..83ce5fa0a604 100644 --- a/block/blk-cgroup.h +++ b/block/blk-cgroup.h | |||
@@ -196,11 +196,6 @@ struct blkio_group { | |||
196 | }; | 196 | }; |
197 | 197 | ||
198 | typedef void (blkio_init_group_fn)(struct blkio_group *blkg); | 198 | typedef void (blkio_init_group_fn)(struct blkio_group *blkg); |
199 | typedef void (blkio_link_group_fn)(struct request_queue *q, | ||
200 | struct blkio_group *blkg); | ||
201 | typedef void (blkio_unlink_group_fn)(struct request_queue *q, | ||
202 | struct blkio_group *blkg); | ||
203 | typedef bool (blkio_clear_queue_fn)(struct request_queue *q); | ||
204 | typedef void (blkio_update_group_weight_fn)(struct request_queue *q, | 199 | typedef void (blkio_update_group_weight_fn)(struct request_queue *q, |
205 | struct blkio_group *blkg, unsigned int weight); | 200 | struct blkio_group *blkg, unsigned int weight); |
206 | typedef void (blkio_update_group_read_bps_fn)(struct request_queue *q, | 201 | typedef void (blkio_update_group_read_bps_fn)(struct request_queue *q, |
@@ -214,9 +209,6 @@ typedef void (blkio_update_group_write_iops_fn)(struct request_queue *q, | |||
214 | 209 | ||
215 | struct blkio_policy_ops { | 210 | struct blkio_policy_ops { |
216 | blkio_init_group_fn *blkio_init_group_fn; | 211 | blkio_init_group_fn *blkio_init_group_fn; |
217 | blkio_link_group_fn *blkio_link_group_fn; | ||
218 | blkio_unlink_group_fn *blkio_unlink_group_fn; | ||
219 | blkio_clear_queue_fn *blkio_clear_queue_fn; | ||
220 | blkio_update_group_weight_fn *blkio_update_group_weight_fn; | 212 | blkio_update_group_weight_fn *blkio_update_group_weight_fn; |
221 | blkio_update_group_read_bps_fn *blkio_update_group_read_bps_fn; | 213 | blkio_update_group_read_bps_fn *blkio_update_group_read_bps_fn; |
222 | blkio_update_group_write_bps_fn *blkio_update_group_write_bps_fn; | 214 | blkio_update_group_write_bps_fn *blkio_update_group_write_bps_fn; |
@@ -238,7 +230,8 @@ extern void blkcg_exit_queue(struct request_queue *q); | |||
238 | /* Blkio controller policy registration */ | 230 | /* Blkio controller policy registration */ |
239 | extern void blkio_policy_register(struct blkio_policy_type *); | 231 | extern void blkio_policy_register(struct blkio_policy_type *); |
240 | extern void blkio_policy_unregister(struct blkio_policy_type *); | 232 | extern void blkio_policy_unregister(struct blkio_policy_type *); |
241 | extern void blkg_destroy_all(struct request_queue *q); | 233 | extern void blkg_destroy_all(struct request_queue *q, |
234 | enum blkio_policy_id plid, bool destroy_root); | ||
242 | 235 | ||
243 | /** | 236 | /** |
244 | * blkg_to_pdata - get policy private data | 237 | * blkg_to_pdata - get policy private data |
@@ -319,7 +312,9 @@ static inline void blkcg_drain_queue(struct request_queue *q) { } | |||
319 | static inline void blkcg_exit_queue(struct request_queue *q) { } | 312 | static inline void blkcg_exit_queue(struct request_queue *q) { } |
320 | static inline void blkio_policy_register(struct blkio_policy_type *blkiop) { } | 313 | static inline void blkio_policy_register(struct blkio_policy_type *blkiop) { } |
321 | static inline void blkio_policy_unregister(struct blkio_policy_type *blkiop) { } | 314 | static inline void blkio_policy_unregister(struct blkio_policy_type *blkiop) { } |
322 | static inline void blkg_destroy_all(struct request_queue *q) { } | 315 | static inline void blkg_destroy_all(struct request_queue *q, |
316 | enum blkio_policy_id plid, | ||
317 | bool destory_root) { } | ||
323 | 318 | ||
324 | static inline void *blkg_to_pdata(struct blkio_group *blkg, | 319 | static inline void *blkg_to_pdata(struct blkio_group *blkg, |
325 | struct blkio_policy_type *pol) { return NULL; } | 320 | struct blkio_policy_type *pol) { return NULL; } |