Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 309267
b: refs/heads/master
c: 03d8e11
h: refs/heads/master
i:
  309265: f1daf40
  309263: 2918dca
v: v3
  • Loading branch information
Tejun Heo authored and Jens Axboe committed Apr 20, 2012
1 parent 6aee3c4 commit 771febe
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b82d4b197c782ced82a8b7b76664125d2d3c156c
refs/heads/master: 03d8e11142a893ad322285d3c8a08e88b570cda1
16 changes: 10 additions & 6 deletions trunk/block/blk-throttle.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ struct throtl_data
/* service tree for active throtl groups */
struct throtl_rb_root tg_service_tree;

struct throtl_grp *root_tg;
struct request_queue *queue;

/* Total Number of queued bios on READ and WRITE lists */
Expand Down Expand Up @@ -131,6 +130,11 @@ static inline struct blkio_group *tg_to_blkg(struct throtl_grp *tg)
return pdata_to_blkg(tg);
}

static inline struct throtl_grp *td_root_tg(struct throtl_data *td)
{
return blkg_to_tg(td->queue->root_blkg);
}

enum tg_state_flags {
THROTL_TG_FLAG_on_rr = 0, /* on round-robin busy list */
};
Expand Down Expand Up @@ -261,7 +265,7 @@ throtl_grp *throtl_lookup_tg(struct throtl_data *td, struct blkio_cgroup *blkcg)
* Avoid lookup in this case
*/
if (blkcg == &blkio_root_cgroup)
return td->root_tg;
return td_root_tg(td);

return blkg_to_tg(blkg_lookup(blkcg, td->queue));
}
Expand All @@ -277,7 +281,7 @@ static struct throtl_grp *throtl_lookup_create_tg(struct throtl_data *td,
* Avoid lookup in this case
*/
if (blkcg == &blkio_root_cgroup) {
tg = td->root_tg;
tg = td_root_tg(td);
} else {
struct blkio_group *blkg;

Expand All @@ -287,7 +291,7 @@ static struct throtl_grp *throtl_lookup_create_tg(struct throtl_data *td,
if (!IS_ERR(blkg))
tg = blkg_to_tg(blkg);
else if (!blk_queue_dead(q))
tg = td->root_tg;
tg = td_root_tg(td);
}

return tg;
Expand Down Expand Up @@ -1245,12 +1249,12 @@ int blk_throtl_init(struct request_queue *q)

blkg = blkg_lookup_create(&blkio_root_cgroup, q, true);
if (!IS_ERR(blkg))
td->root_tg = blkg_to_tg(blkg);
q->root_blkg = blkg;

spin_unlock_irq(q->queue_lock);
rcu_read_unlock();

if (!td->root_tg) {
if (!q->root_blkg) {
kfree(td);
return -ENOMEM;
}
Expand Down
4 changes: 3 additions & 1 deletion trunk/block/cfq-iosched.c
Original file line number Diff line number Diff line change
Expand Up @@ -3964,8 +3964,10 @@ static int cfq_init_queue(struct request_queue *q)
spin_lock_irq(q->queue_lock);

blkg = blkg_lookup_create(&blkio_root_cgroup, q, true);
if (!IS_ERR(blkg))
if (!IS_ERR(blkg)) {
q->root_blkg = blkg;
cfqd->root_group = blkg_to_cfqg(blkg);
}

spin_unlock_irq(q->queue_lock);
rcu_read_unlock();
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/blkdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ struct blk_trace;
struct request;
struct sg_io_hdr;
struct bsg_job;
struct blkio_group;

#define BLKDEV_MIN_RQ 4
#define BLKDEV_MAX_RQ 128 /* Default maximum */
Expand Down Expand Up @@ -369,6 +370,7 @@ struct request_queue {

struct list_head icq_list;
#ifdef CONFIG_BLK_CGROUP
struct blkio_group *root_blkg;
struct list_head blkg_list;
#endif

Expand Down

0 comments on commit 771febe

Please sign in to comment.