aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
Diffstat (limited to 'block')
-rw-r--r--block/blk-cgroup.c22
-rw-r--r--block/blk-cgroup.h3
-rw-r--r--block/cfq-iosched.c4
3 files changed, 27 insertions, 2 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[] = {
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h
index 257dc6a956b6..4f89b967467f 100644
--- a/block/blk-cgroup.h
+++ b/block/blk-cgroup.h
@@ -43,6 +43,9 @@ struct blkio_group {
43 unsigned long sectors; 43 unsigned long sectors;
44}; 44};
45 45
46extern bool blkiocg_css_tryget(struct blkio_cgroup *blkcg);
47extern void blkiocg_css_put(struct blkio_cgroup *blkcg);
48
46#else 49#else
47 50
48struct blkio_group { 51struct blkio_group {
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index b00ca4c86e25..7f3f343b0c65 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -961,7 +961,7 @@ cfq_find_alloc_cfqg(struct cfq_data *cfqd, struct cgroup *cgroup, int create)
961 unsigned int major, minor; 961 unsigned int major, minor;
962 962
963 /* Do we need to take this reference */ 963 /* Do we need to take this reference */
964 if (!css_tryget(&blkcg->css)) 964 if (!blkiocg_css_tryget(blkcg))
965 return NULL;; 965 return NULL;;
966 966
967 cfqg = cfqg_of_blkg(blkiocg_lookup_group(blkcg, key)); 967 cfqg = cfqg_of_blkg(blkiocg_lookup_group(blkcg, key));
@@ -994,7 +994,7 @@ cfq_find_alloc_cfqg(struct cfq_data *cfqd, struct cgroup *cgroup, int create)
994 hlist_add_head(&cfqg->cfqd_node, &cfqd->cfqg_list); 994 hlist_add_head(&cfqg->cfqd_node, &cfqd->cfqg_list);
995 995
996done: 996done:
997 css_put(&blkcg->css); 997 blkiocg_css_put(blkcg);
998 return cfqg; 998 return cfqg;
999} 999}
1000 1000