aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/blk-throttle.c16
-rw-r--r--block/cfq-iosched.c4
-rw-r--r--include/linux/blkdev.h2
3 files changed, 15 insertions, 7 deletions
diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index 6f1bfdf9a1b7..8c520fad6885 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -97,7 +97,6 @@ struct throtl_data
97 /* service tree for active throtl groups */ 97 /* service tree for active throtl groups */
98 struct throtl_rb_root tg_service_tree; 98 struct throtl_rb_root tg_service_tree;
99 99
100 struct throtl_grp *root_tg;
101 struct request_queue *queue; 100 struct request_queue *queue;
102 101
103 /* Total Number of queued bios on READ and WRITE lists */ 102 /* Total Number of queued bios on READ and WRITE lists */
@@ -131,6 +130,11 @@ static inline struct blkio_group *tg_to_blkg(struct throtl_grp *tg)
131 return pdata_to_blkg(tg); 130 return pdata_to_blkg(tg);
132} 131}
133 132
133static inline struct throtl_grp *td_root_tg(struct throtl_data *td)
134{
135 return blkg_to_tg(td->queue->root_blkg);
136}
137
134enum tg_state_flags { 138enum tg_state_flags {
135 THROTL_TG_FLAG_on_rr = 0, /* on round-robin busy list */ 139 THROTL_TG_FLAG_on_rr = 0, /* on round-robin busy list */
136}; 140};
@@ -261,7 +265,7 @@ throtl_grp *throtl_lookup_tg(struct throtl_data *td, struct blkio_cgroup *blkcg)
261 * Avoid lookup in this case 265 * Avoid lookup in this case
262 */ 266 */
263 if (blkcg == &blkio_root_cgroup) 267 if (blkcg == &blkio_root_cgroup)
264 return td->root_tg; 268 return td_root_tg(td);
265 269
266 return blkg_to_tg(blkg_lookup(blkcg, td->queue)); 270 return blkg_to_tg(blkg_lookup(blkcg, td->queue));
267} 271}
@@ -277,7 +281,7 @@ static struct throtl_grp *throtl_lookup_create_tg(struct throtl_data *td,
277 * Avoid lookup in this case 281 * Avoid lookup in this case
278 */ 282 */
279 if (blkcg == &blkio_root_cgroup) { 283 if (blkcg == &blkio_root_cgroup) {
280 tg = td->root_tg; 284 tg = td_root_tg(td);
281 } else { 285 } else {
282 struct blkio_group *blkg; 286 struct blkio_group *blkg;
283 287
@@ -287,7 +291,7 @@ static struct throtl_grp *throtl_lookup_create_tg(struct throtl_data *td,
287 if (!IS_ERR(blkg)) 291 if (!IS_ERR(blkg))
288 tg = blkg_to_tg(blkg); 292 tg = blkg_to_tg(blkg);
289 else if (!blk_queue_dead(q)) 293 else if (!blk_queue_dead(q))
290 tg = td->root_tg; 294 tg = td_root_tg(td);
291 } 295 }
292 296
293 return tg; 297 return tg;
@@ -1245,12 +1249,12 @@ int blk_throtl_init(struct request_queue *q)
1245 1249
1246 blkg = blkg_lookup_create(&blkio_root_cgroup, q, true); 1250 blkg = blkg_lookup_create(&blkio_root_cgroup, q, true);
1247 if (!IS_ERR(blkg)) 1251 if (!IS_ERR(blkg))
1248 td->root_tg = blkg_to_tg(blkg); 1252 q->root_blkg = blkg;
1249 1253
1250 spin_unlock_irq(q->queue_lock); 1254 spin_unlock_irq(q->queue_lock);
1251 rcu_read_unlock(); 1255 rcu_read_unlock();
1252 1256
1253 if (!td->root_tg) { 1257 if (!q->root_blkg) {
1254 kfree(td); 1258 kfree(td);
1255 return -ENOMEM; 1259 return -ENOMEM;
1256 } 1260 }
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index de95f9a2acf8..86440e04f3ee 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -3964,8 +3964,10 @@ static int cfq_init_queue(struct request_queue *q)
3964 spin_lock_irq(q->queue_lock); 3964 spin_lock_irq(q->queue_lock);
3965 3965
3966 blkg = blkg_lookup_create(&blkio_root_cgroup, q, true); 3966 blkg = blkg_lookup_create(&blkio_root_cgroup, q, true);
3967 if (!IS_ERR(blkg)) 3967 if (!IS_ERR(blkg)) {
3968 q->root_blkg = blkg;
3968 cfqd->root_group = blkg_to_cfqg(blkg); 3969 cfqd->root_group = blkg_to_cfqg(blkg);
3970 }
3969 3971
3970 spin_unlock_irq(q->queue_lock); 3972 spin_unlock_irq(q->queue_lock);
3971 rcu_read_unlock(); 3973 rcu_read_unlock();
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index d2c69f8c188a..b01c377fd739 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -31,6 +31,7 @@ struct blk_trace;
31struct request; 31struct request;
32struct sg_io_hdr; 32struct sg_io_hdr;
33struct bsg_job; 33struct bsg_job;
34struct blkio_group;
34 35
35#define BLKDEV_MIN_RQ 4 36#define BLKDEV_MIN_RQ 4
36#define BLKDEV_MAX_RQ 128 /* Default maximum */ 37#define BLKDEV_MAX_RQ 128 /* Default maximum */
@@ -369,6 +370,7 @@ struct request_queue {
369 370
370 struct list_head icq_list; 371 struct list_head icq_list;
371#ifdef CONFIG_BLK_CGROUP 372#ifdef CONFIG_BLK_CGROUP
373 struct blkio_group *root_blkg;
372 struct list_head blkg_list; 374 struct list_head blkg_list;
373#endif 375#endif
374 376