diff options
author | Tejun Heo <tj@kernel.org> | 2012-03-19 15:10:56 -0700 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2012-03-20 12:47:47 +0100 |
commit | 9a9e8a26da4c2c5ddc60999bdea957935fb22b6b (patch) | |
tree | 5a42ef29c2c34174390e4ccf9a2924c0ade6f340 /block/blk-cgroup.c | |
parent | edf1b879e308d37b5b7c414476ab39f79650a253 (diff) | |
download | op-kernel-dev-9a9e8a26da4c2c5ddc60999bdea957935fb22b6b.zip op-kernel-dev-9a9e8a26da4c2c5ddc60999bdea957935fb22b6b.tar.gz |
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/blk-cgroup.c')
-rw-r--r-- | block/blk-cgroup.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index b15a517..30e0730 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c @@ -19,6 +19,7 @@ #include <linux/slab.h> #include <linux/genhd.h> #include <linux/delay.h> +#include <linux/atomic.h> #include "blk-cgroup.h" #include "blk.h" @@ -1622,6 +1623,7 @@ static void blkiocg_destroy(struct cgroup_subsys *subsys, struct cgroup *cgroup) static struct cgroup_subsys_state * blkiocg_create(struct cgroup_subsys *subsys, struct cgroup *cgroup) { + static atomic64_t id_seq = ATOMIC64_INIT(0); struct blkio_cgroup *blkcg; struct cgroup *parent = cgroup->parent; @@ -1635,6 +1637,7 @@ blkiocg_create(struct cgroup_subsys *subsys, struct cgroup *cgroup) return ERR_PTR(-ENOMEM); blkcg->weight = BLKIO_WEIGHT_DEFAULT; + blkcg->id = atomic64_inc_return(&id_seq); /* root is 0, start from 1 */ done: spin_lock_init(&blkcg->lock); INIT_HLIST_HEAD(&blkcg->blkg_list); |