aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-cgroup.c
diff options
context:
space:
mode:
Diffstat (limited to 'block/blk-cgroup.c')
-rw-r--r--block/blk-cgroup.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 73a5525cc0a2..4d4a277b2905 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -13,16 +13,33 @@
13#include <linux/ioprio.h> 13#include <linux/ioprio.h>
14#include <linux/seq_file.h> 14#include <linux/seq_file.h>
15#include <linux/kdev_t.h> 15#include <linux/kdev_t.h>
16#include <linux/module.h>
16#include "blk-cgroup.h" 17#include "blk-cgroup.h"
17#include "cfq-iosched.h" 18#include "cfq-iosched.h"
18 19
19struct blkio_cgroup blkio_root_cgroup = { .weight = 2*BLKIO_WEIGHT_DEFAULT }; 20struct blkio_cgroup blkio_root_cgroup = { .weight = 2*BLKIO_WEIGHT_DEFAULT };
21EXPORT_SYMBOL_GPL(blkio_root_cgroup);
22
23bool blkiocg_css_tryget(struct blkio_cgroup *blkcg)
24{
25 if (!css_tryget(&blkcg->css))
26 return false;
27 return true;
28}
29EXPORT_SYMBOL_GPL(blkiocg_css_tryget);
30
31void blkiocg_css_put(struct blkio_cgroup *blkcg)
32{
33 css_put(&blkcg->css);
34}
35EXPORT_SYMBOL_GPL(blkiocg_css_put);
20 36
21struct blkio_cgroup *cgroup_to_blkio_cgroup(struct cgroup *cgroup) 37struct blkio_cgroup *cgroup_to_blkio_cgroup(struct cgroup *cgroup)
22{ 38{
23 return container_of(cgroup_subsys_state(cgroup, blkio_subsys_id), 39 return container_of(cgroup_subsys_state(cgroup, blkio_subsys_id),
24 struct blkio_cgroup, css); 40 struct blkio_cgroup, css);
25} 41}
42EXPORT_SYMBOL_GPL(cgroup_to_blkio_cgroup);
26 43
27void blkiocg_update_blkio_group_stats(struct blkio_group *blkg, 44void blkiocg_update_blkio_group_stats(struct blkio_group *blkg,
28 unsigned long time, unsigned long sectors) 45 unsigned long time, unsigned long sectors)
@@ -30,6 +47,7 @@ void blkiocg_update_blkio_group_stats(struct blkio_group *blkg,
30 blkg->time += time; 47 blkg->time += time;
31 blkg->sectors += sectors; 48 blkg->sectors += sectors;
32} 49}
50EXPORT_SYMBOL_GPL(blkiocg_update_blkio_group_stats);
33 51
34void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg, 52void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg,
35 struct blkio_group *blkg, void *key, dev_t dev) 53 struct blkio_group *blkg, void *key, dev_t dev)
@@ -47,6 +65,7 @@ void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg,
47#endif 65#endif
48 blkg->dev = dev; 66 blkg->dev = dev;
49} 67}
68EXPORT_SYMBOL_GPL(blkiocg_add_blkio_group);
50 69
51static void __blkiocg_del_blkio_group(struct blkio_group *blkg) 70static void __blkiocg_del_blkio_group(struct blkio_group *blkg)
52{ 71{
@@ -81,6 +100,7 @@ out:
81 rcu_read_unlock(); 100 rcu_read_unlock();
82 return ret; 101 return ret;
83} 102}
103EXPORT_SYMBOL_GPL(blkiocg_del_blkio_group);
84 104
85/* called under rcu_read_lock(). */ 105/* called under rcu_read_lock(). */
86struct blkio_group *blkiocg_lookup_group(struct blkio_cgroup *blkcg, void *key) 106struct blkio_group *blkiocg_lookup_group(struct blkio_cgroup *blkcg, void *key)
@@ -97,6 +117,7 @@ struct blkio_group *blkiocg_lookup_group(struct blkio_cgroup *blkcg, void *key)
97 117
98 return NULL; 118 return NULL;
99} 119}
120EXPORT_SYMBOL_GPL(blkiocg_lookup_group);
100 121
101#define SHOW_FUNCTION(__VAR) \ 122#define SHOW_FUNCTION(__VAR) \
102static u64 blkiocg_##__VAR##_read(struct cgroup *cgroup, \ 123static u64 blkiocg_##__VAR##_read(struct cgroup *cgroup, \
@@ -166,6 +187,7 @@ void blkiocg_update_blkio_group_dequeue_stats(struct blkio_group *blkg,
166{ 187{
167 blkg->dequeue += dequeue; 188 blkg->dequeue += dequeue;
168} 189}
190EXPORT_SYMBOL_GPL(blkiocg_update_blkio_group_dequeue_stats);
169#endif 191#endif
170 192
171struct cftype blkio_files[] = { 193struct cftype blkio_files[] = {