diff options
author | Tejun Heo <tj@kernel.org> | 2012-03-19 18:10:56 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2012-03-20 07:47:47 -0400 |
commit | 9a9e8a26da4c2c5ddc60999bdea957935fb22b6b (patch) | |
tree | 5a42ef29c2c34174390e4ccf9a2924c0ade6f340 /block | |
parent | edf1b879e308d37b5b7c414476ab39f79650a253 (diff) |
blkcg: add blkcg->id
Add 64bit unique id to blkcg. This will be used by policies which
want blkcg identity test to tell whether the associated blkcg has
changed.
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')
-rw-r--r-- | block/blk-cgroup.c | 3 | ||||
-rw-r--r-- | block/blk-cgroup.h | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index b15a51711bca..30e07308db24 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
20 | #include <linux/genhd.h> | 20 | #include <linux/genhd.h> |
21 | #include <linux/delay.h> | 21 | #include <linux/delay.h> |
22 | #include <linux/atomic.h> | ||
22 | #include "blk-cgroup.h" | 23 | #include "blk-cgroup.h" |
23 | #include "blk.h" | 24 | #include "blk.h" |
24 | 25 | ||
@@ -1622,6 +1623,7 @@ static void blkiocg_destroy(struct cgroup_subsys *subsys, struct cgroup *cgroup) | |||
1622 | static struct cgroup_subsys_state * | 1623 | static struct cgroup_subsys_state * |
1623 | blkiocg_create(struct cgroup_subsys *subsys, struct cgroup *cgroup) | 1624 | blkiocg_create(struct cgroup_subsys *subsys, struct cgroup *cgroup) |
1624 | { | 1625 | { |
1626 | static atomic64_t id_seq = ATOMIC64_INIT(0); | ||
1625 | struct blkio_cgroup *blkcg; | 1627 | struct blkio_cgroup *blkcg; |
1626 | struct cgroup *parent = cgroup->parent; | 1628 | struct cgroup *parent = cgroup->parent; |
1627 | 1629 | ||
@@ -1635,6 +1637,7 @@ blkiocg_create(struct cgroup_subsys *subsys, struct cgroup *cgroup) | |||
1635 | return ERR_PTR(-ENOMEM); | 1637 | return ERR_PTR(-ENOMEM); |
1636 | 1638 | ||
1637 | blkcg->weight = BLKIO_WEIGHT_DEFAULT; | 1639 | blkcg->weight = BLKIO_WEIGHT_DEFAULT; |
1640 | blkcg->id = atomic64_inc_return(&id_seq); /* root is 0, start from 1 */ | ||
1638 | done: | 1641 | done: |
1639 | spin_lock_init(&blkcg->lock); | 1642 | spin_lock_init(&blkcg->lock); |
1640 | INIT_HLIST_HEAD(&blkcg->blkg_list); | 1643 | INIT_HLIST_HEAD(&blkcg->blkg_list); |
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h index 9df5ab04b6d6..1cb8f7643258 100644 --- a/block/blk-cgroup.h +++ b/block/blk-cgroup.h | |||
@@ -116,6 +116,9 @@ struct blkio_cgroup { | |||
116 | unsigned int weight; | 116 | unsigned int weight; |
117 | spinlock_t lock; | 117 | spinlock_t lock; |
118 | struct hlist_head blkg_list; | 118 | struct hlist_head blkg_list; |
119 | |||
120 | /* for policies to test whether associated blkcg has changed */ | ||
121 | uint64_t id; | ||
119 | }; | 122 | }; |
120 | 123 | ||
121 | struct blkio_group_stats { | 124 | struct blkio_group_stats { |