]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
blkcg: add blkio_policy_ops operations for exit and stat reset
authorTejun Heo <tj@kernel.org>
Sun, 1 Apr 2012 21:38:44 +0000 (14:38 -0700)
committerTejun Heo <tj@kernel.org>
Sun, 1 Apr 2012 21:38:44 +0000 (14:38 -0700)
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>
block/blk-cgroup.c
block/blk-cgroup.h

index 19ee29f1b7c57d62ce836d62874bfaf2faf776dd..2e6fb7d918050510ed18b62613b940acece55733 100644 (file)
@@ -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);
                }
        }
 
index c82de47ae69f61087b7e3ed6da6ba7ce18e7ec94..d0ee649e8bbb72758fc66f67a2185c23ae511ba1 100644 (file)
@@ -153,9 +153,13 @@ struct blkio_group {
 };
 
 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 {
        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 {