Skip to content

Commit f4da807

Browse files
htejunaxboe
authored andcommitted
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>
1 parent 55872c5 commit f4da807

3 files changed

Lines changed: 5 additions & 10 deletions

File tree

‎block/blk-cgroup.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,6 @@ static void blkcg_css_free(struct cgroup_subsys_state *css)
822822
static struct cgroup_subsys_state *
823823
blkcg_css_alloc(struct cgroup_subsys_state *parent_css)
824824
{
825-
static atomic64_t id_seq = ATOMIC64_INIT(0);
826825
struct blkcg *blkcg;
827826

828827
if (!parent_css) {
@@ -836,7 +835,6 @@ blkcg_css_alloc(struct cgroup_subsys_state *parent_css)
836835

837836
blkcg->cfq_weight = CFQ_WEIGHT_DEFAULT;
838837
blkcg->cfq_leaf_weight = CFQ_WEIGHT_DEFAULT;
839-
blkcg->id = atomic64_inc_return(&id_seq); /* root is 0, start from 1 */
840838
done:
841839
spin_lock_init(&blkcg->lock);
842840
INIT_RADIX_TREE(&blkcg->blkg_tree, GFP_ATOMIC);

‎block/blk-cgroup.h‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,6 @@ struct blkcg {
5050
struct blkcg_gq *blkg_hint;
5151
struct hlist_head blkg_list;
5252

53-
/* for policies to test whether associated blkcg has changed */
54-
uint64_t id;
55-
5653
/* TODO: per-policy storage in blkcg */
5754
unsigned int cfq_weight; /* belongs to cfq */
5855
unsigned int cfq_leaf_weight;

‎block/cfq-iosched.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ struct cfq_io_cq {
299299
struct cfq_ttime ttime;
300300
int ioprio; /* the current ioprio */
301301
#ifdef CONFIG_CFQ_GROUP_IOSCHED
302-
uint64_t blkcg_id; /* the current blkcg ID */
302+
uint64_t blkcg_serial_nr; /* the current blkcg serial */
303303
#endif
304304
};
305305

@@ -3534,17 +3534,17 @@ static void check_blkcg_changed(struct cfq_io_cq *cic, struct bio *bio)
35343534
{
35353535
struct cfq_data *cfqd = cic_to_cfqd(cic);
35363536
struct cfq_queue *sync_cfqq;
3537-
uint64_t id;
3537+
uint64_t serial_nr;
35383538

35393539
rcu_read_lock();
3540-
id = bio_blkcg(bio)->id;
3540+
serial_nr = bio_blkcg(bio)->css.serial_nr;
35413541
rcu_read_unlock();
35423542

35433543
/*
35443544
* Check whether blkcg has changed. The condition may trigger
35453545
* spuriously on a newly created cic but there's no harm.
35463546
*/
3547-
if (unlikely(!cfqd) || likely(cic->blkcg_id == id))
3547+
if (unlikely(!cfqd) || likely(cic->blkcg_serial_nr == serial_nr))
35483548
return;
35493549

35503550
sync_cfqq = cic_to_cfqq(cic, 1);
@@ -3558,7 +3558,7 @@ static void check_blkcg_changed(struct cfq_io_cq *cic, struct bio *bio)
35583558
cfq_put_queue(sync_cfqq);
35593559
}
35603560

3561-
cic->blkcg_id = id;
3561+
cic->blkcg_serial_nr = serial_nr;
35623562
}
35633563
#else
35643564
static inline void check_blkcg_changed(struct cfq_io_cq *cic, struct bio *bio) { }

0 commit comments

Comments
 (0)