aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorDivyesh Shah <dpshah@google.com>2010-04-16 02:10:51 -0400
committerJens Axboe <jens.axboe@oracle.com>2010-04-16 02:10:51 -0400
commit8d2a91f8960b230b8bbcc4d97ed2015f5271c87d (patch)
tree54b742bd0ce37c1ec227178d23d7da347993a6b5 /block
parentb6ac23af2c66e114d3a87ef28d56f1ceec283007 (diff)
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>
Diffstat (limited to 'block')
-rw-r--r--block/blk-cgroup.c7
-rw-r--r--block/blk-cgroup.h2
-rw-r--r--block/cfq-iosched.c1
3 files changed, 1 insertions, 9 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 80c1261a7d38..83930f65016a 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -86,12 +86,6 @@ struct blkio_cgroup *cgroup_to_blkio_cgroup(struct cgroup *cgroup)
86} 86}
87EXPORT_SYMBOL_GPL(cgroup_to_blkio_cgroup); 87EXPORT_SYMBOL_GPL(cgroup_to_blkio_cgroup);
88 88
89void blkio_group_init(struct blkio_group *blkg)
90{
91 spin_lock_init(&blkg->stats_lock);
92}
93EXPORT_SYMBOL_GPL(blkio_group_init);
94
95/* 89/*
96 * Add to the appropriate stat variable depending on the request type. 90 * Add to the appropriate stat variable depending on the request type.
97 * This should be called with the blkg->stats_lock held. 91 * This should be called with the blkg->stats_lock held.
@@ -349,6 +343,7 @@ void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg,
349 unsigned long flags; 343 unsigned long flags;
350 344
351 spin_lock_irqsave(&blkcg->lock, flags); 345 spin_lock_irqsave(&blkcg->lock, flags);
346 spin_lock_init(&blkg->stats_lock);
352 rcu_assign_pointer(blkg->key, key); 347 rcu_assign_pointer(blkg->key, key);
353 blkg->blkcg_id = css_id(&blkcg->css); 348 blkg->blkcg_id = css_id(&blkcg->css);
354 hlist_add_head_rcu(&blkg->blkcg_node, &blkcg->blkg_list); 349 hlist_add_head_rcu(&blkg->blkcg_node, &blkcg->blkg_list);
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h
index 1d409ad9c6e8..2c956a06339a 100644
--- a/block/blk-cgroup.h
+++ b/block/blk-cgroup.h
@@ -217,7 +217,6 @@ extern void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg,
217extern int blkiocg_del_blkio_group(struct blkio_group *blkg); 217extern int blkiocg_del_blkio_group(struct blkio_group *blkg);
218extern struct blkio_group *blkiocg_lookup_group(struct blkio_cgroup *blkcg, 218extern struct blkio_group *blkiocg_lookup_group(struct blkio_cgroup *blkcg,
219 void *key); 219 void *key);
220void blkio_group_init(struct blkio_group *blkg);
221void blkiocg_update_timeslice_used(struct blkio_group *blkg, 220void blkiocg_update_timeslice_used(struct blkio_group *blkg,
222 unsigned long time); 221 unsigned long time);
223void blkiocg_update_dispatch_stats(struct blkio_group *blkg, uint64_t bytes, 222void blkiocg_update_dispatch_stats(struct blkio_group *blkg, uint64_t bytes,
@@ -235,7 +234,6 @@ struct cgroup;
235static inline struct blkio_cgroup * 234static inline struct blkio_cgroup *
236cgroup_to_blkio_cgroup(struct cgroup *cgroup) { return NULL; } 235cgroup_to_blkio_cgroup(struct cgroup *cgroup) { return NULL; }
237 236
238static inline void blkio_group_init(struct blkio_group *blkg) {}
239static inline void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg, 237static inline void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg,
240 struct blkio_group *blkg, void *key, dev_t dev) {} 238 struct blkio_group *blkg, void *key, dev_t dev) {}
241 239
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 01771098355d..62defd05518f 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -961,7 +961,6 @@ cfq_find_alloc_cfqg(struct cfq_data *cfqd, struct cgroup *cgroup, int create)
961 for_each_cfqg_st(cfqg, i, j, st) 961 for_each_cfqg_st(cfqg, i, j, st)
962 *st = CFQ_RB_ROOT; 962 *st = CFQ_RB_ROOT;
963 RB_CLEAR_NODE(&cfqg->rb_node); 963 RB_CLEAR_NODE(&cfqg->rb_node);
964 blkio_group_init(&cfqg->blkg);
965 964
966 /* 965 /*
967 * Take the initial reference that will be released on destroy 966 * Take the initial reference that will be released on destroy