]> nv-tegra.nvidia Code Review - linux-2.6.git/blobdiff - block/blk-cgroup.h
cgroups: blkio subsystem as module
[linux-2.6.git] / block / blk-cgroup.h
index 4f89b967467ff995c45874cb59e20764771df812..8ccc20464daeca7a92cd3c2c2865c45f30e713e2 100644 (file)
 
 #include <linux/cgroup.h>
 
-#ifdef CONFIG_BLK_CGROUP
+#if defined(CONFIG_BLK_CGROUP) || defined(CONFIG_BLK_CGROUP_MODULE)
+
+#ifndef CONFIG_BLK_CGROUP
+/* When blk-cgroup is a module, its subsys_id isn't a compile-time constant */
+extern struct cgroup_subsys blkio_subsys;
+#define blkio_subsys_id blkio_subsys.subsys_id
+#endif
 
 struct blkio_cgroup {
        struct cgroup_subsys_state css;
@@ -43,14 +49,35 @@ struct blkio_group {
        unsigned long sectors;
 };
 
-extern bool blkiocg_css_tryget(struct blkio_cgroup *blkcg);
-extern void blkiocg_css_put(struct blkio_cgroup *blkcg);
+typedef void (blkio_unlink_group_fn) (void *key, struct blkio_group *blkg);
+typedef void (blkio_update_group_weight_fn) (struct blkio_group *blkg,
+                                               unsigned int weight);
+
+struct blkio_policy_ops {
+       blkio_unlink_group_fn *blkio_unlink_group_fn;
+       blkio_update_group_weight_fn *blkio_update_group_weight_fn;
+};
+
+struct blkio_policy_type {
+       struct list_head list;
+       struct blkio_policy_ops ops;
+};
+
+/* Blkio controller policy registration */
+extern void blkio_policy_register(struct blkio_policy_type *);
+extern void blkio_policy_unregister(struct blkio_policy_type *);
 
 #else
 
 struct blkio_group {
 };
 
+struct blkio_policy_type {
+};
+
+static inline void blkio_policy_register(struct blkio_policy_type *blkiop) { }
+static inline void blkio_policy_unregister(struct blkio_policy_type *blkiop) { }
+
 #endif
 
 #define BLKIO_WEIGHT_MIN       100
@@ -70,7 +97,7 @@ static inline void blkiocg_update_blkio_group_dequeue_stats(
                        struct blkio_group *blkg, unsigned long dequeue) {}
 #endif
 
-#ifdef CONFIG_BLK_CGROUP
+#if defined(CONFIG_BLK_CGROUP) || defined(CONFIG_BLK_CGROUP_MODULE)
 extern struct blkio_cgroup blkio_root_cgroup;
 extern struct blkio_cgroup *cgroup_to_blkio_cgroup(struct cgroup *cgroup);
 extern void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg,