diff options
author | Tejun Heo <tj@kernel.org> | 2012-04-01 14:38:44 -0700 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2012-04-01 14:38:44 -0700 |
commit | 9ade5ea4ce57d3596eaee6a57cd212a483674058 (patch) | |
tree | cad2cc4ecb116f114cc73098b1704a47d82edd18 /block/blk-cgroup.c | |
parent | 41b38b6d540f951c49315d8573e6f6195a6e736d (diff) |
blkcg: add blkio_policy_ops operations for exit and stat reset
Add blkio_policy_ops->blkio_exit_group_fn() and
->blkio_reset_group_stats_fn(). These will be used to further
modularize blkcg policy implementation.
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'block/blk-cgroup.c')
-rw-r--r-- | block/blk-cgroup.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 19ee29f1b7c..2e6fb7d9180 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c @@ -131,12 +131,17 @@ static void blkg_free(struct blkio_group *blkg) return; for (i = 0; i < BLKIO_NR_POLICIES; i++) { + struct blkio_policy_type *pol = blkio_policy[i]; struct blkg_policy_data *pd = blkg->pd[i]; - if (pd) { - free_percpu(pd->stats_cpu); - kfree(pd); - } + if (!pd) + continue; + + if (pol && pol->ops.blkio_exit_group_fn) + pol->ops.blkio_exit_group_fn(blkg); + + free_percpu(pd->stats_cpu); + kfree(pd); } kfree(blkg); @@ -432,6 +437,9 @@ blkiocg_reset_stats(struct cgroup *cgroup, struct cftype *cftype, u64 val) blkg_stat_reset(&stats->empty_time); #endif blkio_reset_stats_cpu(blkg, pol->plid); + + if (pol->ops.blkio_reset_group_stats_fn) + pol->ops.blkio_reset_group_stats_fn(blkg); } } |