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>
This commit is contained in:
parent
edf1b879e3
commit
9a9e8a26da
|
@ -19,6 +19,7 @@
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/genhd.h>
|
#include <linux/genhd.h>
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
|
#include <linux/atomic.h>
|
||||||
#include "blk-cgroup.h"
|
#include "blk-cgroup.h"
|
||||||
#include "blk.h"
|
#include "blk.h"
|
||||||
|
|
||||||
|
@ -1622,6 +1623,7 @@ static void blkiocg_destroy(struct cgroup_subsys *subsys, struct cgroup *cgroup)
|
||||||
static struct cgroup_subsys_state *
|
static struct cgroup_subsys_state *
|
||||||
blkiocg_create(struct cgroup_subsys *subsys, struct cgroup *cgroup)
|
blkiocg_create(struct cgroup_subsys *subsys, struct cgroup *cgroup)
|
||||||
{
|
{
|
||||||
|
static atomic64_t id_seq = ATOMIC64_INIT(0);
|
||||||
struct blkio_cgroup *blkcg;
|
struct blkio_cgroup *blkcg;
|
||||||
struct cgroup *parent = cgroup->parent;
|
struct cgroup *parent = cgroup->parent;
|
||||||
|
|
||||||
|
@ -1635,6 +1637,7 @@ blkiocg_create(struct cgroup_subsys *subsys, struct cgroup *cgroup)
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
||||||
blkcg->weight = BLKIO_WEIGHT_DEFAULT;
|
blkcg->weight = BLKIO_WEIGHT_DEFAULT;
|
||||||
|
blkcg->id = atomic64_inc_return(&id_seq); /* root is 0, start from 1 */
|
||||||
done:
|
done:
|
||||||
spin_lock_init(&blkcg->lock);
|
spin_lock_init(&blkcg->lock);
|
||||||
INIT_HLIST_HEAD(&blkcg->blkg_list);
|
INIT_HLIST_HEAD(&blkcg->blkg_list);
|
||||||
|
|
|
@ -116,6 +116,9 @@ struct blkio_cgroup {
|
||||||
unsigned int weight;
|
unsigned int weight;
|
||||||
spinlock_t lock;
|
spinlock_t lock;
|
||||||
struct hlist_head blkg_list;
|
struct hlist_head blkg_list;
|
||||||
|
|
||||||
|
/* for policies to test whether associated blkcg has changed */
|
||||||
|
uint64_t id;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct blkio_group_stats {
|
struct blkio_group_stats {
|
||||||
|
|
Loading…
Reference in New Issue