Commit 9ade5ea4 authored by Tejun Heo's avatar Tejun Heo

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: default avatarTejun Heo <tj@kernel.org>
parent 41b38b6d
...@@ -131,12 +131,17 @@ static void blkg_free(struct blkio_group *blkg) ...@@ -131,12 +131,17 @@ static void blkg_free(struct blkio_group *blkg)
return; return;
for (i = 0; i < BLKIO_NR_POLICIES; i++) { for (i = 0; i < BLKIO_NR_POLICIES; i++) {
struct blkio_policy_type *pol = blkio_policy[i];
struct blkg_policy_data *pd = blkg->pd[i]; struct blkg_policy_data *pd = blkg->pd[i];
if (pd) { if (!pd)
free_percpu(pd->stats_cpu); continue;
kfree(pd);
} if (pol && pol->ops.blkio_exit_group_fn)
pol->ops.blkio_exit_group_fn(blkg);
free_percpu(pd->stats_cpu);
kfree(pd);
} }
kfree(blkg); kfree(blkg);
...@@ -432,6 +437,9 @@ blkiocg_reset_stats(struct cgroup *cgroup, struct cftype *cftype, u64 val) ...@@ -432,6 +437,9 @@ blkiocg_reset_stats(struct cgroup *cgroup, struct cftype *cftype, u64 val)
blkg_stat_reset(&stats->empty_time); blkg_stat_reset(&stats->empty_time);
#endif #endif
blkio_reset_stats_cpu(blkg, pol->plid); blkio_reset_stats_cpu(blkg, pol->plid);
if (pol->ops.blkio_reset_group_stats_fn)
pol->ops.blkio_reset_group_stats_fn(blkg);
} }
} }
......
...@@ -153,9 +153,13 @@ struct blkio_group { ...@@ -153,9 +153,13 @@ struct blkio_group {
}; };
typedef void (blkio_init_group_fn)(struct blkio_group *blkg); typedef void (blkio_init_group_fn)(struct blkio_group *blkg);
typedef void (blkio_exit_group_fn)(struct blkio_group *blkg);
typedef void (blkio_reset_group_stats_fn)(struct blkio_group *blkg);
struct blkio_policy_ops { struct blkio_policy_ops {
blkio_init_group_fn *blkio_init_group_fn; blkio_init_group_fn *blkio_init_group_fn;
blkio_exit_group_fn *blkio_exit_group_fn;
blkio_reset_group_stats_fn *blkio_reset_group_stats_fn;
}; };
struct blkio_policy_type { struct blkio_policy_type {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment