summaryrefslogtreecommitdiffstats
path: root/block/blk-throttle.c
diff options
context:
space:
mode:
Diffstat (limited to 'block/blk-throttle.c')
-rw-r--r--block/blk-throttle.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index 6613de78e364..aeeb798d1cda 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -1252,7 +1252,6 @@ void blk_throtl_drain(struct request_queue *q)
int blk_throtl_init(struct request_queue *q)
{
struct throtl_data *td;
- struct throtl_grp *tg;
td = kzalloc_node(sizeof(*td), GFP_KERNEL, q->node);
if (!td)
@@ -1265,19 +1264,20 @@ int blk_throtl_init(struct request_queue *q)
/* alloc and Init root group. */
td->queue = q;
- tg = throtl_alloc_tg(td);
- if (!tg) {
- kfree(td);
- return -ENOMEM;
- }
+ rcu_read_lock();
+ spin_lock_irq(q->queue_lock);
- td->root_tg = tg;
+ td->root_tg = throtl_get_tg(td, &blkio_root_cgroup);
- rcu_read_lock();
- throtl_init_add_tg_lists(td, tg, &blkio_root_cgroup);
+ spin_unlock_irq(q->queue_lock);
rcu_read_unlock();
+ if (!td->root_tg) {
+ kfree(td);
+ return -ENOMEM;
+ }
+
/* Attach throtl data to request queue */
q->td = td;
return 0;