Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 251155
b: refs/heads/master
c: 269f541
h: refs/heads/master
i:
  251153: 925c574
  251151: 4a8cdeb
v: v3
  • Loading branch information
Vivek Goyal authored and Jens Axboe committed May 20, 2011
1 parent 69444af commit e7d8ed9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 13 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: 29b125892f3317ada86b662e0b6ebc0f79be9037
refs/heads/master: 269f541555d8f5da322d592fb3e13e23ed62d80c
35 changes: 23 additions & 12 deletions trunk/block/blk-throttle.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,16 +188,34 @@ throtl_add_group_to_td_list(struct throtl_data *td, struct throtl_grp *tg)
td->nr_undestroyed_grps++;
}

static void throtl_init_add_tg_lists(struct throtl_data *td,
struct throtl_grp *tg, struct blkio_cgroup *blkcg)
static void
__throtl_tg_fill_dev_details(struct throtl_data *td, struct throtl_grp *tg)
{
struct backing_dev_info *bdi = &td->queue->backing_dev_info;
unsigned int major, minor;

if (!tg || tg->blkg.dev)
return;

/*
* Fill in device details for a group which might not have been
* filled at group creation time as queue was being instantiated
* and driver had not attached a device yet
*/
if (bdi->dev && dev_name(bdi->dev)) {
sscanf(dev_name(bdi->dev), "%u:%u", &major, &minor);
tg->blkg.dev = MKDEV(major, minor);
}
}

static void throtl_init_add_tg_lists(struct throtl_data *td,
struct throtl_grp *tg, struct blkio_cgroup *blkcg)
{
__throtl_tg_fill_dev_details(td, tg);

/* Add group onto cgroup list */
sscanf(dev_name(bdi->dev), "%u:%u", &major, &minor);
blkiocg_add_blkio_group(blkcg, &tg->blkg, (void *)td,
MKDEV(major, minor), BLKIO_POLICY_THROTL);
tg->blkg.dev, BLKIO_POLICY_THROTL);

tg->bps[READ] = blkcg_get_read_bps(blkcg, tg->blkg.dev);
tg->bps[WRITE] = blkcg_get_write_bps(blkcg, tg->blkg.dev);
Expand Down Expand Up @@ -225,8 +243,6 @@ throtl_grp *throtl_find_tg(struct throtl_data *td, struct blkio_cgroup *blkcg)
{
struct throtl_grp *tg = NULL;
void *key = td;
struct backing_dev_info *bdi = &td->queue->backing_dev_info;
unsigned int major, minor;

/*
* This is the common case when there are no blkio cgroups.
Expand All @@ -237,12 +253,7 @@ throtl_grp *throtl_find_tg(struct throtl_data *td, struct blkio_cgroup *blkcg)
else
tg = tg_of_blkg(blkiocg_lookup_group(blkcg, key));

/* Fill in device details for root group */
if (tg && !tg->blkg.dev && bdi->dev && dev_name(bdi->dev)) {
sscanf(dev_name(bdi->dev), "%u:%u", &major, &minor);
tg->blkg.dev = MKDEV(major, minor);
}

__throtl_tg_fill_dev_details(td, tg);
return tg;
}

Expand Down

0 comments on commit e7d8ed9

Please sign in to comment.