diff options
author | Jens Axboe <jens.axboe@oracle.com> | 2010-03-19 03:05:10 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2010-03-19 03:05:10 -0400 |
commit | b4b7a4ef097f288f724420b473dbf92a89c0ab7e (patch) | |
tree | 23ad8101e3e77c32a8d1e1b95a9c1cd7f7a475b7 /block | |
parent | e9ce335df51ff782035a15c261a3c0c9892a1767 (diff) | |
parent | a3d3203e4bb40f253b1541e310dc0f9305be7c84 (diff) |
Merge branch 'master' into for-linus
Conflicts:
block/Kconfig
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/Kconfig.iosched | 2 | ||||
-rw-r--r-- | block/blk-cgroup.c | 53 | ||||
-rw-r--r-- | block/blk-cgroup.h | 10 | ||||
-rw-r--r-- | block/blk-integrity.c | 2 | ||||
-rw-r--r-- | block/blk-sysfs.c | 2 | ||||
-rw-r--r-- | block/bsg.c | 2 | ||||
-rw-r--r-- | block/elevator.c | 2 |
7 files changed, 54 insertions, 19 deletions
diff --git a/block/Kconfig.iosched b/block/Kconfig.iosched index b71abfb0d726..fc71cf071fb2 100644 --- a/block/Kconfig.iosched +++ b/block/Kconfig.iosched | |||
@@ -23,6 +23,7 @@ config IOSCHED_DEADLINE | |||
23 | 23 | ||
24 | config IOSCHED_CFQ | 24 | config IOSCHED_CFQ |
25 | tristate "CFQ I/O scheduler" | 25 | tristate "CFQ I/O scheduler" |
26 | select BLK_CGROUP if CFQ_GROUP_IOSCHED | ||
26 | default y | 27 | default y |
27 | ---help--- | 28 | ---help--- |
28 | The CFQ I/O scheduler tries to distribute bandwidth equally | 29 | The CFQ I/O scheduler tries to distribute bandwidth equally |
@@ -35,7 +36,6 @@ config IOSCHED_CFQ | |||
35 | config CFQ_GROUP_IOSCHED | 36 | config CFQ_GROUP_IOSCHED |
36 | bool "CFQ Group Scheduling support" | 37 | bool "CFQ Group Scheduling support" |
37 | depends on IOSCHED_CFQ && CGROUPS | 38 | depends on IOSCHED_CFQ && CGROUPS |
38 | select BLK_CGROUP | ||
39 | default n | 39 | default n |
40 | ---help--- | 40 | ---help--- |
41 | Enable group IO scheduling in CFQ. | 41 | Enable group IO scheduling in CFQ. |
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index c85d74cae200..4b686ad08eaa 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c | |||
@@ -23,6 +23,31 @@ static LIST_HEAD(blkio_list); | |||
23 | struct blkio_cgroup blkio_root_cgroup = { .weight = 2*BLKIO_WEIGHT_DEFAULT }; | 23 | struct blkio_cgroup blkio_root_cgroup = { .weight = 2*BLKIO_WEIGHT_DEFAULT }; |
24 | EXPORT_SYMBOL_GPL(blkio_root_cgroup); | 24 | EXPORT_SYMBOL_GPL(blkio_root_cgroup); |
25 | 25 | ||
26 | static struct cgroup_subsys_state *blkiocg_create(struct cgroup_subsys *, | ||
27 | struct cgroup *); | ||
28 | static int blkiocg_can_attach(struct cgroup_subsys *, struct cgroup *, | ||
29 | struct task_struct *, bool); | ||
30 | static void blkiocg_attach(struct cgroup_subsys *, struct cgroup *, | ||
31 | struct cgroup *, struct task_struct *, bool); | ||
32 | static void blkiocg_destroy(struct cgroup_subsys *, struct cgroup *); | ||
33 | static int blkiocg_populate(struct cgroup_subsys *, struct cgroup *); | ||
34 | |||
35 | struct cgroup_subsys blkio_subsys = { | ||
36 | .name = "blkio", | ||
37 | .create = blkiocg_create, | ||
38 | .can_attach = blkiocg_can_attach, | ||
39 | .attach = blkiocg_attach, | ||
40 | .destroy = blkiocg_destroy, | ||
41 | .populate = blkiocg_populate, | ||
42 | #ifdef CONFIG_BLK_CGROUP | ||
43 | /* note: blkio_subsys_id is otherwise defined in blk-cgroup.h */ | ||
44 | .subsys_id = blkio_subsys_id, | ||
45 | #endif | ||
46 | .use_id = 1, | ||
47 | .module = THIS_MODULE, | ||
48 | }; | ||
49 | EXPORT_SYMBOL_GPL(blkio_subsys); | ||
50 | |||
26 | struct blkio_cgroup *cgroup_to_blkio_cgroup(struct cgroup *cgroup) | 51 | struct blkio_cgroup *cgroup_to_blkio_cgroup(struct cgroup *cgroup) |
27 | { | 52 | { |
28 | return container_of(cgroup_subsys_state(cgroup, blkio_subsys_id), | 53 | return container_of(cgroup_subsys_state(cgroup, blkio_subsys_id), |
@@ -253,7 +278,8 @@ remove_entry: | |||
253 | done: | 278 | done: |
254 | free_css_id(&blkio_subsys, &blkcg->css); | 279 | free_css_id(&blkio_subsys, &blkcg->css); |
255 | rcu_read_unlock(); | 280 | rcu_read_unlock(); |
256 | kfree(blkcg); | 281 | if (blkcg != &blkio_root_cgroup) |
282 | kfree(blkcg); | ||
257 | } | 283 | } |
258 | 284 | ||
259 | static struct cgroup_subsys_state * | 285 | static struct cgroup_subsys_state * |
@@ -319,17 +345,6 @@ static void blkiocg_attach(struct cgroup_subsys *subsys, struct cgroup *cgroup, | |||
319 | task_unlock(tsk); | 345 | task_unlock(tsk); |
320 | } | 346 | } |
321 | 347 | ||
322 | struct cgroup_subsys blkio_subsys = { | ||
323 | .name = "blkio", | ||
324 | .create = blkiocg_create, | ||
325 | .can_attach = blkiocg_can_attach, | ||
326 | .attach = blkiocg_attach, | ||
327 | .destroy = blkiocg_destroy, | ||
328 | .populate = blkiocg_populate, | ||
329 | .subsys_id = blkio_subsys_id, | ||
330 | .use_id = 1, | ||
331 | }; | ||
332 | |||
333 | void blkio_policy_register(struct blkio_policy_type *blkiop) | 348 | void blkio_policy_register(struct blkio_policy_type *blkiop) |
334 | { | 349 | { |
335 | spin_lock(&blkio_list_lock); | 350 | spin_lock(&blkio_list_lock); |
@@ -345,3 +360,17 @@ void blkio_policy_unregister(struct blkio_policy_type *blkiop) | |||
345 | spin_unlock(&blkio_list_lock); | 360 | spin_unlock(&blkio_list_lock); |
346 | } | 361 | } |
347 | EXPORT_SYMBOL_GPL(blkio_policy_unregister); | 362 | EXPORT_SYMBOL_GPL(blkio_policy_unregister); |
363 | |||
364 | static int __init init_cgroup_blkio(void) | ||
365 | { | ||
366 | return cgroup_load_subsys(&blkio_subsys); | ||
367 | } | ||
368 | |||
369 | static void __exit exit_cgroup_blkio(void) | ||
370 | { | ||
371 | cgroup_unload_subsys(&blkio_subsys); | ||
372 | } | ||
373 | |||
374 | module_init(init_cgroup_blkio); | ||
375 | module_exit(exit_cgroup_blkio); | ||
376 | MODULE_LICENSE("GPL"); | ||
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h index 84bf745fa775..8ccc20464dae 100644 --- a/block/blk-cgroup.h +++ b/block/blk-cgroup.h | |||
@@ -15,7 +15,13 @@ | |||
15 | 15 | ||
16 | #include <linux/cgroup.h> | 16 | #include <linux/cgroup.h> |
17 | 17 | ||
18 | #ifdef CONFIG_BLK_CGROUP | 18 | #if defined(CONFIG_BLK_CGROUP) || defined(CONFIG_BLK_CGROUP_MODULE) |
19 | |||
20 | #ifndef CONFIG_BLK_CGROUP | ||
21 | /* When blk-cgroup is a module, its subsys_id isn't a compile-time constant */ | ||
22 | extern struct cgroup_subsys blkio_subsys; | ||
23 | #define blkio_subsys_id blkio_subsys.subsys_id | ||
24 | #endif | ||
19 | 25 | ||
20 | struct blkio_cgroup { | 26 | struct blkio_cgroup { |
21 | struct cgroup_subsys_state css; | 27 | struct cgroup_subsys_state css; |
@@ -91,7 +97,7 @@ static inline void blkiocg_update_blkio_group_dequeue_stats( | |||
91 | struct blkio_group *blkg, unsigned long dequeue) {} | 97 | struct blkio_group *blkg, unsigned long dequeue) {} |
92 | #endif | 98 | #endif |
93 | 99 | ||
94 | #ifdef CONFIG_BLK_CGROUP | 100 | #if defined(CONFIG_BLK_CGROUP) || defined(CONFIG_BLK_CGROUP_MODULE) |
95 | extern struct blkio_cgroup blkio_root_cgroup; | 101 | extern struct blkio_cgroup blkio_root_cgroup; |
96 | extern struct blkio_cgroup *cgroup_to_blkio_cgroup(struct cgroup *cgroup); | 102 | extern struct blkio_cgroup *cgroup_to_blkio_cgroup(struct cgroup *cgroup); |
97 | extern void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg, | 103 | extern void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg, |
diff --git a/block/blk-integrity.c b/block/blk-integrity.c index 15c630813b1c..96e83c2bdb94 100644 --- a/block/blk-integrity.c +++ b/block/blk-integrity.c | |||
@@ -278,7 +278,7 @@ static struct attribute *integrity_attrs[] = { | |||
278 | NULL, | 278 | NULL, |
279 | }; | 279 | }; |
280 | 280 | ||
281 | static struct sysfs_ops integrity_ops = { | 281 | static const struct sysfs_ops integrity_ops = { |
282 | .show = &integrity_attr_show, | 282 | .show = &integrity_attr_show, |
283 | .store = &integrity_attr_store, | 283 | .store = &integrity_attr_store, |
284 | }; | 284 | }; |
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index fad86550255a..4426739fb757 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c | |||
@@ -475,7 +475,7 @@ static void blk_release_queue(struct kobject *kobj) | |||
475 | kmem_cache_free(blk_requestq_cachep, q); | 475 | kmem_cache_free(blk_requestq_cachep, q); |
476 | } | 476 | } |
477 | 477 | ||
478 | static struct sysfs_ops queue_sysfs_ops = { | 478 | static const struct sysfs_ops queue_sysfs_ops = { |
479 | .show = queue_attr_show, | 479 | .show = queue_attr_show, |
480 | .store = queue_attr_store, | 480 | .store = queue_attr_store, |
481 | }; | 481 | }; |
diff --git a/block/bsg.c b/block/bsg.c index a9fd2d84b53a..46597a6bd112 100644 --- a/block/bsg.c +++ b/block/bsg.c | |||
@@ -260,7 +260,7 @@ bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm, | |||
260 | return ERR_PTR(ret); | 260 | return ERR_PTR(ret); |
261 | 261 | ||
262 | /* | 262 | /* |
263 | * map scatter-gather elements seperately and string them to request | 263 | * map scatter-gather elements separately and string them to request |
264 | */ | 264 | */ |
265 | rq = blk_get_request(q, rw, GFP_KERNEL); | 265 | rq = blk_get_request(q, rw, GFP_KERNEL); |
266 | if (!rq) | 266 | if (!rq) |
diff --git a/block/elevator.c b/block/elevator.c index ee3a883840f2..df75676f6671 100644 --- a/block/elevator.c +++ b/block/elevator.c | |||
@@ -892,7 +892,7 @@ elv_attr_store(struct kobject *kobj, struct attribute *attr, | |||
892 | return error; | 892 | return error; |
893 | } | 893 | } |
894 | 894 | ||
895 | static struct sysfs_ops elv_sysfs_ops = { | 895 | static const struct sysfs_ops elv_sysfs_ops = { |
896 | .show = elv_attr_show, | 896 | .show = elv_attr_show, |
897 | .store = elv_attr_store, | 897 | .store = elv_attr_store, |
898 | }; | 898 | }; |