aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/blk-cgroup.c16
-rw-r--r--block/blk-cgroup.h4
2 files changed, 16 insertions, 4 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 19ee29f1b7c5..2e6fb7d91805 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -131,12 +131,17 @@ static void blkg_free(struct blkio_group *blkg)
131 return; 131 return;
132 132
133 for (i = 0; i < BLKIO_NR_POLICIES; i++) { 133 for (i = 0; i < BLKIO_NR_POLICIES; i++) {
134 struct blkio_policy_type *pol = blkio_policy[i];
134 struct blkg_policy_data *pd = blkg->pd[i]; 135 struct blkg_policy_data *pd = blkg->pd[i];
135 136
136 if (pd) { 137 if (!pd)
137 free_percpu(pd->stats_cpu); 138 continue;
138 kfree(pd); 139
139 } 140 if (pol && pol->ops.blkio_exit_group_fn)
141 pol->ops.blkio_exit_group_fn(blkg);
142
143 free_percpu(pd->stats_cpu);
144 kfree(pd);
140 } 145 }
141 146
142 kfree(blkg); 147 kfree(blkg);
@@ -432,6 +437,9 @@ blkiocg_reset_stats(struct cgroup *cgroup, struct cftype *cftype, u64 val)
432 blkg_stat_reset(&stats->empty_time); 437 blkg_stat_reset(&stats->empty_time);
433#endif 438#endif
434 blkio_reset_stats_cpu(blkg, pol->plid); 439 blkio_reset_stats_cpu(blkg, pol->plid);
440
441 if (pol->ops.blkio_reset_group_stats_fn)
442 pol->ops.blkio_reset_group_stats_fn(blkg);
435 } 443 }
436 } 444 }
437 445
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h
index c82de47ae69f..d0ee649e8bbb 100644
--- a/block/blk-cgroup.h
+++ b/block/blk-cgroup.h
@@ -153,9 +153,13 @@ struct blkio_group {
153}; 153};
154 154
155typedef void (blkio_init_group_fn)(struct blkio_group *blkg); 155typedef void (blkio_init_group_fn)(struct blkio_group *blkg);
156typedef void (blkio_exit_group_fn)(struct blkio_group *blkg);
157typedef void (blkio_reset_group_stats_fn)(struct blkio_group *blkg);
156 158
157struct blkio_policy_ops { 159struct blkio_policy_ops {
158 blkio_init_group_fn *blkio_init_group_fn; 160 blkio_init_group_fn *blkio_init_group_fn;
161 blkio_exit_group_fn *blkio_exit_group_fn;
162 blkio_reset_group_stats_fn *blkio_reset_group_stats_fn;
159}; 163};
160 164
161struct blkio_policy_type { 165struct blkio_policy_type {