Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Tejun Heo and committed by
Jens Axboe
9a9e8a26 edf1b879

+6
+3
block/blk-cgroup.c
··· 19 19 #include <linux/slab.h> 20 20 #include <linux/genhd.h> 21 21 #include <linux/delay.h> 22 + #include <linux/atomic.h> 22 23 #include "blk-cgroup.h" 23 24 #include "blk.h" 24 25 ··· 1623 1622 static struct cgroup_subsys_state * 1624 1623 blkiocg_create(struct cgroup_subsys *subsys, struct cgroup *cgroup) 1625 1624 { 1625 + static atomic64_t id_seq = ATOMIC64_INIT(0); 1626 1626 struct blkio_cgroup *blkcg; 1627 1627 struct cgroup *parent = cgroup->parent; 1628 1628 ··· 1637 1635 return ERR_PTR(-ENOMEM); 1638 1636 1639 1637 blkcg->weight = BLKIO_WEIGHT_DEFAULT; 1638 + blkcg->id = atomic64_inc_return(&id_seq); /* root is 0, start from 1 */ 1640 1639 done: 1641 1640 spin_lock_init(&blkcg->lock); 1642 1641 INIT_HLIST_HEAD(&blkcg->blkg_list);
+3
block/blk-cgroup.h
··· 116 116 unsigned int weight; 117 117 spinlock_t lock; 118 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 124 struct blkio_group_stats {