|
@@ -97,7 +97,6 @@ struct throtl_data
|
|
/* service tree for active throtl groups */
|
|
/* service tree for active throtl groups */
|
|
struct throtl_rb_root tg_service_tree;
|
|
struct throtl_rb_root tg_service_tree;
|
|
|
|
|
|
- struct throtl_grp *root_tg;
|
|
|
|
struct request_queue *queue;
|
|
struct request_queue *queue;
|
|
|
|
|
|
/* Total Number of queued bios on READ and WRITE lists */
|
|
/* 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)
|
|
return pdata_to_blkg(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 {
|
|
enum tg_state_flags {
|
|
THROTL_TG_FLAG_on_rr = 0, /* on round-robin busy list */
|
|
THROTL_TG_FLAG_on_rr = 0, /* on round-robin busy list */
|
|
};
|
|
};
|
|
@@ -261,7 +265,7 @@ throtl_grp *throtl_lookup_tg(struct throtl_data *td, struct blkio_cgroup *blkcg)
|
|
* Avoid lookup in this case
|
|
* Avoid lookup in this case
|
|
*/
|
|
*/
|
|
if (blkcg == &blkio_root_cgroup)
|
|
if (blkcg == &blkio_root_cgroup)
|
|
- return td->root_tg;
|
|
|
|
|
|
+ return td_root_tg(td);
|
|
|
|
|
|
return blkg_to_tg(blkg_lookup(blkcg, td->queue));
|
|
return blkg_to_tg(blkg_lookup(blkcg, td->queue));
|
|
}
|
|
}
|
|
@@ -277,7 +281,7 @@ static struct throtl_grp *throtl_lookup_create_tg(struct throtl_data *td,
|
|
* Avoid lookup in this case
|
|
* Avoid lookup in this case
|
|
*/
|
|
*/
|
|
if (blkcg == &blkio_root_cgroup) {
|
|
if (blkcg == &blkio_root_cgroup) {
|
|
- tg = td->root_tg;
|
|
|
|
|
|
+ tg = td_root_tg(td);
|
|
} else {
|
|
} else {
|
|
struct blkio_group *blkg;
|
|
struct blkio_group *blkg;
|
|
|
|
|
|
@@ -287,7 +291,7 @@ static struct throtl_grp *throtl_lookup_create_tg(struct throtl_data *td,
|
|
if (!IS_ERR(blkg))
|
|
if (!IS_ERR(blkg))
|
|
tg = blkg_to_tg(blkg);
|
|
tg = blkg_to_tg(blkg);
|
|
else if (!blk_queue_dead(q))
|
|
else if (!blk_queue_dead(q))
|
|
- tg = td->root_tg;
|
|
|
|
|
|
+ tg = td_root_tg(td);
|
|
}
|
|
}
|
|
|
|
|
|
return tg;
|
|
return tg;
|
|
@@ -1245,12 +1249,12 @@ int blk_throtl_init(struct request_queue *q)
|
|
|
|
|
|
blkg = blkg_lookup_create(&blkio_root_cgroup, q, true);
|
|
blkg = blkg_lookup_create(&blkio_root_cgroup, q, true);
|
|
if (!IS_ERR(blkg))
|
|
if (!IS_ERR(blkg))
|
|
- td->root_tg = blkg_to_tg(blkg);
|
|
|
|
|
|
+ q->root_blkg = blkg;
|
|
|
|
|
|
spin_unlock_irq(q->queue_lock);
|
|
spin_unlock_irq(q->queue_lock);
|
|
rcu_read_unlock();
|
|
rcu_read_unlock();
|
|
|
|
|
|
- if (!td->root_tg) {
|
|
|
|
|
|
+ if (!q->root_blkg) {
|
|
kfree(td);
|
|
kfree(td);
|
|
return -ENOMEM;
|
|
return -ENOMEM;
|
|
}
|
|
}
|