Skip to content

Commit

Permalink
blkio: Add root group to td->tg_list
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Vivek Goyal authored and Jens Axboe committed Oct 1, 2010
1 parent 61014e9 commit 02977e4
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions block/blk-throttle.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ struct throtl_data
unsigned int nr_queued[2];

/*
* number of total undestroyed groups (excluding root group)
* number of total undestroyed groups
*/
unsigned int nr_undestroyed_grps;

Expand Down Expand Up @@ -940,7 +940,17 @@ int blk_throtl_init(struct request_queue *q)
/* Practically unlimited BW */
tg->bps[0] = tg->bps[1] = -1;
tg->iops[0] = tg->iops[1] = -1;
atomic_set(&tg->ref, 1);

/*
* Set root group reference to 2. One reference will be dropped when
* all groups on tg_list are being deleted during queue exit. Other
* reference will remain there as we don't want to delete this group
* as it is statically allocated and gets destroyed when throtl_data
* goes away.
*/
atomic_set(&tg->ref, 2);
hlist_add_head(&tg->tg_node, &td->tg_list);
td->nr_undestroyed_grps++;

INIT_DELAYED_WORK(&td->throtl_work, blk_throtl_work);

Expand All @@ -966,10 +976,9 @@ void blk_throtl_exit(struct request_queue *q)

spin_lock_irq(q->queue_lock);
throtl_release_tgs(td);
blkiocg_del_blkio_group(&td->root_tg.blkg);

/* If there are other groups */
if (td->nr_undestroyed_grps >= 1)
if (td->nr_undestroyed_grps > 0)
wait = true;

spin_unlock_irq(q->queue_lock);
Expand Down

0 comments on commit 02977e4

Please sign in to comment.