diff options
author | Tejun Heo <tj@kernel.org> | 2012-04-01 15:09:55 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2012-04-01 15:09:55 -0400 |
commit | 676f7c8f84d15e94065841529016da5ab92e901b (patch) | |
tree | 29c267a4c5711f9eaca7fa88fd7a78d39c8c4eac /block | |
parent | 6e6ff25bd548a0c5bf5163e4f63e2793dcefbdcb (diff) |
cgroup: relocate cftype and cgroup_subsys definitions in controllers
blk-cgroup, netprio_cgroup, cls_cgroup and tcp_memcontrol
unnecessarily define cftype array and cgroup_subsys structures at the
top of the file, which is unconventional and necessiates forward
declaration of methods.
This patch relocates those below the definitions of the methods and
removes the forward declarations. Note that forward declaration of
tcp_files[] is added in tcp_memcontrol.c for tcp_init_cgroup(). This
will be removed soon by another patch.
This patch doesn't introduce any functional change.
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Li Zefan <lizf@cn.fujitsu.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-cgroup.c | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index ea84a23d5e68..60ef16d6d155 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c | |||
@@ -28,34 +28,12 @@ static LIST_HEAD(blkio_list); | |||
28 | struct blkio_cgroup blkio_root_cgroup = { .weight = 2*BLKIO_WEIGHT_DEFAULT }; | 28 | struct blkio_cgroup blkio_root_cgroup = { .weight = 2*BLKIO_WEIGHT_DEFAULT }; |
29 | EXPORT_SYMBOL_GPL(blkio_root_cgroup); | 29 | EXPORT_SYMBOL_GPL(blkio_root_cgroup); |
30 | 30 | ||
31 | static struct cgroup_subsys_state *blkiocg_create(struct cgroup *); | ||
32 | static int blkiocg_can_attach(struct cgroup *, struct cgroup_taskset *); | ||
33 | static void blkiocg_attach(struct cgroup *, struct cgroup_taskset *); | ||
34 | static void blkiocg_destroy(struct cgroup *); | ||
35 | static int blkiocg_populate(struct cgroup_subsys *, struct cgroup *); | ||
36 | |||
37 | /* for encoding cft->private value on file */ | 31 | /* for encoding cft->private value on file */ |
38 | #define BLKIOFILE_PRIVATE(x, val) (((x) << 16) | (val)) | 32 | #define BLKIOFILE_PRIVATE(x, val) (((x) << 16) | (val)) |
39 | /* What policy owns the file, proportional or throttle */ | 33 | /* What policy owns the file, proportional or throttle */ |
40 | #define BLKIOFILE_POLICY(val) (((val) >> 16) & 0xffff) | 34 | #define BLKIOFILE_POLICY(val) (((val) >> 16) & 0xffff) |
41 | #define BLKIOFILE_ATTR(val) ((val) & 0xffff) | 35 | #define BLKIOFILE_ATTR(val) ((val) & 0xffff) |
42 | 36 | ||
43 | struct cgroup_subsys blkio_subsys = { | ||
44 | .name = "blkio", | ||
45 | .create = blkiocg_create, | ||
46 | .can_attach = blkiocg_can_attach, | ||
47 | .attach = blkiocg_attach, | ||
48 | .destroy = blkiocg_destroy, | ||
49 | .populate = blkiocg_populate, | ||
50 | #ifdef CONFIG_BLK_CGROUP | ||
51 | /* note: blkio_subsys_id is otherwise defined in blk-cgroup.h */ | ||
52 | .subsys_id = blkio_subsys_id, | ||
53 | #endif | ||
54 | .use_id = 1, | ||
55 | .module = THIS_MODULE, | ||
56 | }; | ||
57 | EXPORT_SYMBOL_GPL(blkio_subsys); | ||
58 | |||
59 | static inline void blkio_policy_insert_node(struct blkio_cgroup *blkcg, | 37 | static inline void blkio_policy_insert_node(struct blkio_cgroup *blkcg, |
60 | struct blkio_policy_node *pn) | 38 | struct blkio_policy_node *pn) |
61 | { | 39 | { |
@@ -1658,6 +1636,22 @@ static void blkiocg_attach(struct cgroup *cgrp, struct cgroup_taskset *tset) | |||
1658 | } | 1636 | } |
1659 | } | 1637 | } |
1660 | 1638 | ||
1639 | struct cgroup_subsys blkio_subsys = { | ||
1640 | .name = "blkio", | ||
1641 | .create = blkiocg_create, | ||
1642 | .can_attach = blkiocg_can_attach, | ||
1643 | .attach = blkiocg_attach, | ||
1644 | .destroy = blkiocg_destroy, | ||
1645 | .populate = blkiocg_populate, | ||
1646 | #ifdef CONFIG_BLK_CGROUP | ||
1647 | /* note: blkio_subsys_id is otherwise defined in blk-cgroup.h */ | ||
1648 | .subsys_id = blkio_subsys_id, | ||
1649 | #endif | ||
1650 | .use_id = 1, | ||
1651 | .module = THIS_MODULE, | ||
1652 | }; | ||
1653 | EXPORT_SYMBOL_GPL(blkio_subsys); | ||
1654 | |||
1661 | void blkio_policy_register(struct blkio_policy_type *blkiop) | 1655 | void blkio_policy_register(struct blkio_policy_type *blkiop) |
1662 | { | 1656 | { |
1663 | spin_lock(&blkio_list_lock); | 1657 | spin_lock(&blkio_list_lock); |