aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
Diffstat (limited to 'block')
-rw-r--r--block/blk-cgroup.c45
1 files changed, 17 insertions, 28 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index ea84a23d5e68..126c341955de 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -28,34 +28,12 @@ static LIST_HEAD(blkio_list);
28struct blkio_cgroup blkio_root_cgroup = { .weight = 2*BLKIO_WEIGHT_DEFAULT }; 28struct blkio_cgroup blkio_root_cgroup = { .weight = 2*BLKIO_WEIGHT_DEFAULT };
29EXPORT_SYMBOL_GPL(blkio_root_cgroup); 29EXPORT_SYMBOL_GPL(blkio_root_cgroup);
30 30
31static struct cgroup_subsys_state *blkiocg_create(struct cgroup *);
32static int blkiocg_can_attach(struct cgroup *, struct cgroup_taskset *);
33static void blkiocg_attach(struct cgroup *, struct cgroup_taskset *);
34static void blkiocg_destroy(struct cgroup *);
35static 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
43struct 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};
57EXPORT_SYMBOL_GPL(blkio_subsys);
58
59static inline void blkio_policy_insert_node(struct blkio_cgroup *blkcg, 37static inline void blkio_policy_insert_node(struct blkio_cgroup *blkcg,
60 struct blkio_policy_node *pn) 38 struct blkio_policy_node *pn)
61{ 39{
@@ -1537,14 +1515,9 @@ struct cftype blkio_files[] = {
1537 .read_map = blkiocg_file_read_map, 1515 .read_map = blkiocg_file_read_map,
1538 }, 1516 },
1539#endif 1517#endif
1518 { } /* terminate */
1540}; 1519};
1541 1520
1542static int blkiocg_populate(struct cgroup_subsys *subsys, struct cgroup *cgroup)
1543{
1544 return cgroup_add_files(cgroup, subsys, blkio_files,
1545 ARRAY_SIZE(blkio_files));
1546}
1547
1548static void blkiocg_destroy(struct cgroup *cgroup) 1521static void blkiocg_destroy(struct cgroup *cgroup)
1549{ 1522{
1550 struct blkio_cgroup *blkcg = cgroup_to_blkio_cgroup(cgroup); 1523 struct blkio_cgroup *blkcg = cgroup_to_blkio_cgroup(cgroup);
@@ -1658,6 +1631,22 @@ static void blkiocg_attach(struct cgroup *cgrp, struct cgroup_taskset *tset)
1658 } 1631 }
1659} 1632}
1660 1633
1634struct cgroup_subsys blkio_subsys = {
1635 .name = "blkio",
1636 .create = blkiocg_create,
1637 .can_attach = blkiocg_can_attach,
1638 .attach = blkiocg_attach,
1639 .destroy = blkiocg_destroy,
1640#ifdef CONFIG_BLK_CGROUP
1641 /* note: blkio_subsys_id is otherwise defined in blk-cgroup.h */
1642 .subsys_id = blkio_subsys_id,
1643#endif
1644 .base_cftypes = blkio_files,
1645 .use_id = 1,
1646 .module = THIS_MODULE,
1647};
1648EXPORT_SYMBOL_GPL(blkio_subsys);
1649
1661void blkio_policy_register(struct blkio_policy_type *blkiop) 1650void blkio_policy_register(struct blkio_policy_type *blkiop)
1662{ 1651{
1663 spin_lock(&blkio_list_lock); 1652 spin_lock(&blkio_list_lock);