diff options
Diffstat (limited to 'block/cfq-iosched.c')
-rw-r--r-- | block/cfq-iosched.c | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 46b0a1d1d925..ab7a9e6a9b1c 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -1014,10 +1014,9 @@ void cfq_update_blkio_group_weight(void *key, struct blkio_group *blkg, | |||
1014 | cfqg->needs_update = true; | 1014 | cfqg->needs_update = true; |
1015 | } | 1015 | } |
1016 | 1016 | ||
1017 | static struct cfq_group * | 1017 | static struct cfq_group * cfq_find_alloc_cfqg(struct cfq_data *cfqd, |
1018 | cfq_find_alloc_cfqg(struct cfq_data *cfqd, struct cgroup *cgroup, int create) | 1018 | struct blkio_cgroup *blkcg, int create) |
1019 | { | 1019 | { |
1020 | struct blkio_cgroup *blkcg = cgroup_to_blkio_cgroup(cgroup); | ||
1021 | struct cfq_group *cfqg = NULL; | 1020 | struct cfq_group *cfqg = NULL; |
1022 | void *key = cfqd; | 1021 | void *key = cfqd; |
1023 | int i, j; | 1022 | int i, j; |
@@ -1079,12 +1078,12 @@ done: | |||
1079 | */ | 1078 | */ |
1080 | static struct cfq_group *cfq_get_cfqg(struct cfq_data *cfqd, int create) | 1079 | static struct cfq_group *cfq_get_cfqg(struct cfq_data *cfqd, int create) |
1081 | { | 1080 | { |
1082 | struct cgroup *cgroup; | 1081 | struct blkio_cgroup *blkcg; |
1083 | struct cfq_group *cfqg = NULL; | 1082 | struct cfq_group *cfqg = NULL; |
1084 | 1083 | ||
1085 | rcu_read_lock(); | 1084 | rcu_read_lock(); |
1086 | cgroup = task_cgroup(current, blkio_subsys_id); | 1085 | blkcg = task_blkio_cgroup(current); |
1087 | cfqg = cfq_find_alloc_cfqg(cfqd, cgroup, create); | 1086 | cfqg = cfq_find_alloc_cfqg(cfqd, blkcg, create); |
1088 | if (!cfqg && create) | 1087 | if (!cfqg && create) |
1089 | cfqg = &cfqd->root_group; | 1088 | cfqg = &cfqd->root_group; |
1090 | rcu_read_unlock(); | 1089 | rcu_read_unlock(); |
@@ -2582,28 +2581,20 @@ static void cfq_put_queue(struct cfq_queue *cfqq) | |||
2582 | } | 2581 | } |
2583 | 2582 | ||
2584 | /* | 2583 | /* |
2585 | * Must always be called with the rcu_read_lock() held | 2584 | * Call func for each cic attached to this ioc. |
2586 | */ | 2585 | */ |
2587 | static void | 2586 | static void |
2588 | __call_for_each_cic(struct io_context *ioc, | 2587 | call_for_each_cic(struct io_context *ioc, |
2589 | void (*func)(struct io_context *, struct cfq_io_context *)) | 2588 | void (*func)(struct io_context *, struct cfq_io_context *)) |
2590 | { | 2589 | { |
2591 | struct cfq_io_context *cic; | 2590 | struct cfq_io_context *cic; |
2592 | struct hlist_node *n; | 2591 | struct hlist_node *n; |
2593 | 2592 | ||
2593 | rcu_read_lock(); | ||
2594 | |||
2594 | hlist_for_each_entry_rcu(cic, n, &ioc->cic_list, cic_list) | 2595 | hlist_for_each_entry_rcu(cic, n, &ioc->cic_list, cic_list) |
2595 | func(ioc, cic); | 2596 | func(ioc, cic); |
2596 | } | ||
2597 | 2597 | ||
2598 | /* | ||
2599 | * Call func for each cic attached to this ioc. | ||
2600 | */ | ||
2601 | static void | ||
2602 | call_for_each_cic(struct io_context *ioc, | ||
2603 | void (*func)(struct io_context *, struct cfq_io_context *)) | ||
2604 | { | ||
2605 | rcu_read_lock(); | ||
2606 | __call_for_each_cic(ioc, func); | ||
2607 | rcu_read_unlock(); | 2598 | rcu_read_unlock(); |
2608 | } | 2599 | } |
2609 | 2600 | ||
@@ -2664,7 +2655,7 @@ static void cfq_free_io_context(struct io_context *ioc) | |||
2664 | * should be ok to iterate over the known list, we will see all cic's | 2655 | * should be ok to iterate over the known list, we will see all cic's |
2665 | * since no new ones are added. | 2656 | * since no new ones are added. |
2666 | */ | 2657 | */ |
2667 | __call_for_each_cic(ioc, cic_free_func); | 2658 | call_for_each_cic(ioc, cic_free_func); |
2668 | } | 2659 | } |
2669 | 2660 | ||
2670 | static void cfq_put_cooperator(struct cfq_queue *cfqq) | 2661 | static void cfq_put_cooperator(struct cfq_queue *cfqq) |