diff options
author | Tejun Heo <tj@kernel.org> | 2014-09-07 19:15:20 -0400 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2014-09-08 11:55:37 -0400 |
commit | f4da80727cfbc3590d95ff17ef8db96e6f1483a4 (patch) | |
tree | cd073c26cb66e6d2f8640c3aabb412ff22946b63 /block | |
parent | 55872c5a3c01f0fe7b5298d19e24e237f5b5ff06 (diff) |
blkcg: remove blkcg->id
blkcg->id is a unique id given to each blkcg; however, the
cgroup_subsys_state which each blkcg embeds already has ->serial_nr
which can be used for the same purpose. Drop blkcg->id and replace
its uses with blkcg->css.serial_nr. Rename cfq_cgroup->blkcg_id to
->blkcg_serial_nr and @id in check_blkcg_changed() to @serial_nr for
consistency.
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-cgroup.c | 2 | ||||
-rw-r--r-- | block/blk-cgroup.h | 3 | ||||
-rw-r--r-- | block/cfq-iosched.c | 10 |
3 files changed, 5 insertions, 10 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index e17da947f6bd..0ac817b750db 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c | |||
@@ -822,7 +822,6 @@ static void blkcg_css_free(struct cgroup_subsys_state *css) | |||
822 | static struct cgroup_subsys_state * | 822 | static struct cgroup_subsys_state * |
823 | blkcg_css_alloc(struct cgroup_subsys_state *parent_css) | 823 | blkcg_css_alloc(struct cgroup_subsys_state *parent_css) |
824 | { | 824 | { |
825 | static atomic64_t id_seq = ATOMIC64_INIT(0); | ||
826 | struct blkcg *blkcg; | 825 | struct blkcg *blkcg; |
827 | 826 | ||
828 | if (!parent_css) { | 827 | if (!parent_css) { |
@@ -836,7 +835,6 @@ blkcg_css_alloc(struct cgroup_subsys_state *parent_css) | |||
836 | 835 | ||
837 | blkcg->cfq_weight = CFQ_WEIGHT_DEFAULT; | 836 | blkcg->cfq_weight = CFQ_WEIGHT_DEFAULT; |
838 | blkcg->cfq_leaf_weight = CFQ_WEIGHT_DEFAULT; | 837 | blkcg->cfq_leaf_weight = CFQ_WEIGHT_DEFAULT; |
839 | blkcg->id = atomic64_inc_return(&id_seq); /* root is 0, start from 1 */ | ||
840 | done: | 838 | done: |
841 | spin_lock_init(&blkcg->lock); | 839 | spin_lock_init(&blkcg->lock); |
842 | INIT_RADIX_TREE(&blkcg->blkg_tree, GFP_ATOMIC); | 840 | INIT_RADIX_TREE(&blkcg->blkg_tree, GFP_ATOMIC); |
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h index d3fd7aa3d2a3..c567865b5f1d 100644 --- a/block/blk-cgroup.h +++ b/block/blk-cgroup.h | |||
@@ -50,9 +50,6 @@ struct blkcg { | |||
50 | struct blkcg_gq *blkg_hint; | 50 | struct blkcg_gq *blkg_hint; |
51 | struct hlist_head blkg_list; | 51 | struct hlist_head blkg_list; |
52 | 52 | ||
53 | /* for policies to test whether associated blkcg has changed */ | ||
54 | uint64_t id; | ||
55 | |||
56 | /* TODO: per-policy storage in blkcg */ | 53 | /* TODO: per-policy storage in blkcg */ |
57 | unsigned int cfq_weight; /* belongs to cfq */ | 54 | unsigned int cfq_weight; /* belongs to cfq */ |
58 | unsigned int cfq_leaf_weight; | 55 | unsigned int cfq_leaf_weight; |
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index cadc37841744..900f569afcc5 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -299,7 +299,7 @@ struct cfq_io_cq { | |||
299 | struct cfq_ttime ttime; | 299 | struct cfq_ttime ttime; |
300 | int ioprio; /* the current ioprio */ | 300 | int ioprio; /* the current ioprio */ |
301 | #ifdef CONFIG_CFQ_GROUP_IOSCHED | 301 | #ifdef CONFIG_CFQ_GROUP_IOSCHED |
302 | uint64_t blkcg_id; /* the current blkcg ID */ | 302 | uint64_t blkcg_serial_nr; /* the current blkcg serial */ |
303 | #endif | 303 | #endif |
304 | }; | 304 | }; |
305 | 305 | ||
@@ -3534,17 +3534,17 @@ static void check_blkcg_changed(struct cfq_io_cq *cic, struct bio *bio) | |||
3534 | { | 3534 | { |
3535 | struct cfq_data *cfqd = cic_to_cfqd(cic); | 3535 | struct cfq_data *cfqd = cic_to_cfqd(cic); |
3536 | struct cfq_queue *sync_cfqq; | 3536 | struct cfq_queue *sync_cfqq; |
3537 | uint64_t id; | 3537 | uint64_t serial_nr; |
3538 | 3538 | ||
3539 | rcu_read_lock(); | 3539 | rcu_read_lock(); |
3540 | id = bio_blkcg(bio)->id; | 3540 | serial_nr = bio_blkcg(bio)->css.serial_nr; |
3541 | rcu_read_unlock(); | 3541 | rcu_read_unlock(); |
3542 | 3542 | ||
3543 | /* | 3543 | /* |
3544 | * Check whether blkcg has changed. The condition may trigger | 3544 | * Check whether blkcg has changed. The condition may trigger |
3545 | * spuriously on a newly created cic but there's no harm. | 3545 | * spuriously on a newly created cic but there's no harm. |
3546 | */ | 3546 | */ |
3547 | if (unlikely(!cfqd) || likely(cic->blkcg_id == id)) | 3547 | if (unlikely(!cfqd) || likely(cic->blkcg_serial_nr == serial_nr)) |
3548 | return; | 3548 | return; |
3549 | 3549 | ||
3550 | sync_cfqq = cic_to_cfqq(cic, 1); | 3550 | sync_cfqq = cic_to_cfqq(cic, 1); |
@@ -3558,7 +3558,7 @@ static void check_blkcg_changed(struct cfq_io_cq *cic, struct bio *bio) | |||
3558 | cfq_put_queue(sync_cfqq); | 3558 | cfq_put_queue(sync_cfqq); |
3559 | } | 3559 | } |
3560 | 3560 | ||
3561 | cic->blkcg_id = id; | 3561 | cic->blkcg_serial_nr = serial_nr; |
3562 | } | 3562 | } |
3563 | #else | 3563 | #else |
3564 | static inline void check_blkcg_changed(struct cfq_io_cq *cic, struct bio *bio) { } | 3564 | static inline void check_blkcg_changed(struct cfq_io_cq *cic, struct bio *bio) { } |