Skip to content

Commit 8d2a91f

Browse files
Divyesh ShahJens Axboe
authored andcommitted
blkio: Initialize blkg->stats_lock for the root cfqg too
This fixes the lockdep warning reported by Gui Jianfeng. Signed-off-by: Divyesh Shah <dpshah@google.com> Reviewed-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
1 parent b6ac23a commit 8d2a91f

3 files changed

Lines changed: 1 addition & 9 deletions

File tree

‎block/blk-cgroup.c‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,6 @@ struct blkio_cgroup *cgroup_to_blkio_cgroup(struct cgroup *cgroup)
8686
}
8787
EXPORT_SYMBOL_GPL(cgroup_to_blkio_cgroup);
8888

89-
void blkio_group_init(struct blkio_group *blkg)
90-
{
91-
spin_lock_init(&blkg->stats_lock);
92-
}
93-
EXPORT_SYMBOL_GPL(blkio_group_init);
94-
9589
/*
9690
* Add to the appropriate stat variable depending on the request type.
9791
* This should be called with the blkg->stats_lock held.
@@ -349,6 +343,7 @@ void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg,
349343
unsigned long flags;
350344

351345
spin_lock_irqsave(&blkcg->lock, flags);
346+
spin_lock_init(&blkg->stats_lock);
352347
rcu_assign_pointer(blkg->key, key);
353348
blkg->blkcg_id = css_id(&blkcg->css);
354349
hlist_add_head_rcu(&blkg->blkcg_node, &blkcg->blkg_list);

‎block/blk-cgroup.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,6 @@ extern void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg,
217217
extern int blkiocg_del_blkio_group(struct blkio_group *blkg);
218218
extern struct blkio_group *blkiocg_lookup_group(struct blkio_cgroup *blkcg,
219219
void *key);
220-
void blkio_group_init(struct blkio_group *blkg);
221220
void blkiocg_update_timeslice_used(struct blkio_group *blkg,
222221
unsigned long time);
223222
void blkiocg_update_dispatch_stats(struct blkio_group *blkg, uint64_t bytes,
@@ -235,7 +234,6 @@ struct cgroup;
235234
static inline struct blkio_cgroup *
236235
cgroup_to_blkio_cgroup(struct cgroup *cgroup) { return NULL; }
237236

238-
static inline void blkio_group_init(struct blkio_group *blkg) {}
239237
static inline void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg,
240238
struct blkio_group *blkg, void *key, dev_t dev) {}
241239

‎block/cfq-iosched.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,6 @@ cfq_find_alloc_cfqg(struct cfq_data *cfqd, struct cgroup *cgroup, int create)
961961
for_each_cfqg_st(cfqg, i, j, st)
962962
*st = CFQ_RB_ROOT;
963963
RB_CLEAR_NODE(&cfqg->rb_node);
964-
blkio_group_init(&cfqg->blkg);
965964

966965
/*
967966
* Take the initial reference that will be released on destroy

0 commit comments

Comments
 (0)