Commit 02977e4af7ed3b478c505e50491ffdf3e1314cf4
Committed by
Jens Axboe
1 parent
61014e96e6
Exists in
master
and in
7 other branches
blkio: Add root group to td->tg_list
o Currently all the dynamically allocated groups, except root grp is added to td->tg_list. This was not a problem so far but in next patch I will travel through td->tg_list to process any updates of limits on the group. If root group is not in tg_list, then root group's updates are not processed. o It is better to root group also to tg_list instead of doing special processing for it during limit updates. Signed-off-by: Vivek Goyal <vgoyal@redhat.com> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Showing 1 changed file with 13 additions and 4 deletions Side-by-side Diff
block/blk-throttle.c
... | ... | @@ -87,7 +87,7 @@ |
87 | 87 | unsigned int nr_queued[2]; |
88 | 88 | |
89 | 89 | /* |
90 | - * number of total undestroyed groups (excluding root group) | |
90 | + * number of total undestroyed groups | |
91 | 91 | */ |
92 | 92 | unsigned int nr_undestroyed_grps; |
93 | 93 | |
94 | 94 | |
... | ... | @@ -940,8 +940,18 @@ |
940 | 940 | /* Practically unlimited BW */ |
941 | 941 | tg->bps[0] = tg->bps[1] = -1; |
942 | 942 | tg->iops[0] = tg->iops[1] = -1; |
943 | - atomic_set(&tg->ref, 1); | |
944 | 943 | |
944 | + /* | |
945 | + * Set root group reference to 2. One reference will be dropped when | |
946 | + * all groups on tg_list are being deleted during queue exit. Other | |
947 | + * reference will remain there as we don't want to delete this group | |
948 | + * as it is statically allocated and gets destroyed when throtl_data | |
949 | + * goes away. | |
950 | + */ | |
951 | + atomic_set(&tg->ref, 2); | |
952 | + hlist_add_head(&tg->tg_node, &td->tg_list); | |
953 | + td->nr_undestroyed_grps++; | |
954 | + | |
945 | 955 | INIT_DELAYED_WORK(&td->throtl_work, blk_throtl_work); |
946 | 956 | |
947 | 957 | rcu_read_lock(); |
948 | 958 | |
... | ... | @@ -966,10 +976,9 @@ |
966 | 976 | |
967 | 977 | spin_lock_irq(q->queue_lock); |
968 | 978 | throtl_release_tgs(td); |
969 | - blkiocg_del_blkio_group(&td->root_tg.blkg); | |
970 | 979 | |
971 | 980 | /* If there are other groups */ |
972 | - if (td->nr_undestroyed_grps >= 1) | |
981 | + if (td->nr_undestroyed_grps > 0) | |
973 | 982 | wait = true; |
974 | 983 | |
975 | 984 | spin_unlock_irq(q->queue_lock); |