diff options
Diffstat (limited to 'block/elevator.c')
-rw-r--r-- | block/elevator.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/block/elevator.c b/block/elevator.c index 77856bf29568..7bda083d5968 100644 --- a/block/elevator.c +++ b/block/elevator.c | |||
@@ -83,6 +83,16 @@ bool elv_bio_merge_ok(struct request *rq, struct bio *bio) | |||
83 | } | 83 | } |
84 | EXPORT_SYMBOL(elv_bio_merge_ok); | 84 | EXPORT_SYMBOL(elv_bio_merge_ok); |
85 | 85 | ||
86 | static bool elevator_match(const struct elevator_type *e, const char *name) | ||
87 | { | ||
88 | if (!strcmp(e->elevator_name, name)) | ||
89 | return true; | ||
90 | if (e->elevator_alias && !strcmp(e->elevator_alias, name)) | ||
91 | return true; | ||
92 | |||
93 | return false; | ||
94 | } | ||
95 | |||
86 | /* | 96 | /* |
87 | * Return scheduler with name 'name' and with matching 'mq capability | 97 | * Return scheduler with name 'name' and with matching 'mq capability |
88 | */ | 98 | */ |
@@ -91,7 +101,7 @@ static struct elevator_type *elevator_find(const char *name, bool mq) | |||
91 | struct elevator_type *e; | 101 | struct elevator_type *e; |
92 | 102 | ||
93 | list_for_each_entry(e, &elv_list, list) { | 103 | list_for_each_entry(e, &elv_list, list) { |
94 | if (!strcmp(e->elevator_name, name) && (mq == e->uses_mq)) | 104 | if (elevator_match(e, name) && (mq == e->uses_mq)) |
95 | return e; | 105 | return e; |
96 | } | 106 | } |
97 | 107 | ||
@@ -922,9 +932,9 @@ int elv_register(struct elevator_type *e) | |||
922 | spin_unlock(&elv_list_lock); | 932 | spin_unlock(&elv_list_lock); |
923 | 933 | ||
924 | /* print pretty message */ | 934 | /* print pretty message */ |
925 | if (!strcmp(e->elevator_name, chosen_elevator) || | 935 | if (elevator_match(e, chosen_elevator) || |
926 | (!*chosen_elevator && | 936 | (!*chosen_elevator && |
927 | !strcmp(e->elevator_name, CONFIG_DEFAULT_IOSCHED))) | 937 | elevator_match(e, CONFIG_DEFAULT_IOSCHED))) |
928 | def = " (default)"; | 938 | def = " (default)"; |
929 | 939 | ||
930 | printk(KERN_INFO "io scheduler %s registered%s\n", e->elevator_name, | 940 | printk(KERN_INFO "io scheduler %s registered%s\n", e->elevator_name, |
@@ -1077,8 +1087,7 @@ static int __elevator_change(struct request_queue *q, const char *name) | |||
1077 | if (!e) | 1087 | if (!e) |
1078 | return -EINVAL; | 1088 | return -EINVAL; |
1079 | 1089 | ||
1080 | if (q->elevator && | 1090 | if (q->elevator && elevator_match(q->elevator->type, elevator_name)) { |
1081 | !strcmp(elevator_name, q->elevator->type->elevator_name)) { | ||
1082 | elevator_put(e); | 1091 | elevator_put(e); |
1083 | return 0; | 1092 | return 0; |
1084 | } | 1093 | } |
@@ -1114,6 +1123,7 @@ ssize_t elv_iosched_show(struct request_queue *q, char *name) | |||
1114 | struct elevator_queue *e = q->elevator; | 1123 | struct elevator_queue *e = q->elevator; |
1115 | struct elevator_type *elv = NULL; | 1124 | struct elevator_type *elv = NULL; |
1116 | struct elevator_type *__e; | 1125 | struct elevator_type *__e; |
1126 | bool uses_mq = q->mq_ops != NULL; | ||
1117 | int len = 0; | 1127 | int len = 0; |
1118 | 1128 | ||
1119 | if (!queue_is_rq_based(q)) | 1129 | if (!queue_is_rq_based(q)) |
@@ -1126,7 +1136,8 @@ ssize_t elv_iosched_show(struct request_queue *q, char *name) | |||
1126 | 1136 | ||
1127 | spin_lock(&elv_list_lock); | 1137 | spin_lock(&elv_list_lock); |
1128 | list_for_each_entry(__e, &elv_list, list) { | 1138 | list_for_each_entry(__e, &elv_list, list) { |
1129 | if (elv && !strcmp(elv->elevator_name, __e->elevator_name)) { | 1139 | if (elv && elevator_match(elv, __e->elevator_name) && |
1140 | (__e->uses_mq == uses_mq)) { | ||
1130 | len += sprintf(name+len, "[%s] ", elv->elevator_name); | 1141 | len += sprintf(name+len, "[%s] ", elv->elevator_name); |
1131 | continue; | 1142 | continue; |
1132 | } | 1143 | } |