aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
Diffstat (limited to 'block')
-rw-r--r--block/blk-sysfs.c6
-rw-r--r--block/elevator.c13
2 files changed, 15 insertions, 4 deletions
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index 142a4acddd43..3ccdadb8e204 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -395,9 +395,6 @@ int blk_register_queue(struct gendisk *disk)
395 if (WARN_ON(!q)) 395 if (WARN_ON(!q))
396 return -ENXIO; 396 return -ENXIO;
397 397
398 if (!q->request_fn)
399 return 0;
400
401 ret = kobject_add(&q->kobj, kobject_get(&disk_to_dev(disk)->kobj), 398 ret = kobject_add(&q->kobj, kobject_get(&disk_to_dev(disk)->kobj),
402 "%s", "queue"); 399 "%s", "queue");
403 if (ret < 0) 400 if (ret < 0)
@@ -405,6 +402,9 @@ int blk_register_queue(struct gendisk *disk)
405 402
406 kobject_uevent(&q->kobj, KOBJ_ADD); 403 kobject_uevent(&q->kobj, KOBJ_ADD);
407 404
405 if (!q->request_fn)
406 return 0;
407
408 ret = elv_register_queue(q); 408 ret = elv_register_queue(q);
409 if (ret) { 409 if (ret) {
410 kobject_uevent(&q->kobj, KOBJ_REMOVE); 410 kobject_uevent(&q->kobj, KOBJ_REMOVE);
diff --git a/block/elevator.c b/block/elevator.c
index ebee948293eb..bd78f693fcf2 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -575,6 +575,9 @@ void elv_drain_elevator(struct request_queue *q)
575 */ 575 */
576void elv_quiesce_start(struct request_queue *q) 576void elv_quiesce_start(struct request_queue *q)
577{ 577{
578 if (!q->elevator)
579 return;
580
578 queue_flag_set(QUEUE_FLAG_ELVSWITCH, q); 581 queue_flag_set(QUEUE_FLAG_ELVSWITCH, q);
579 582
580 /* 583 /*
@@ -1050,6 +1053,9 @@ ssize_t elv_iosched_store(struct request_queue *q, const char *name,
1050 char elevator_name[ELV_NAME_MAX]; 1053 char elevator_name[ELV_NAME_MAX];
1051 struct elevator_type *e; 1054 struct elevator_type *e;
1052 1055
1056 if (!q->elevator)
1057 return count;
1058
1053 strlcpy(elevator_name, name, sizeof(elevator_name)); 1059 strlcpy(elevator_name, name, sizeof(elevator_name));
1054 strstrip(elevator_name); 1060 strstrip(elevator_name);
1055 1061
@@ -1073,10 +1079,15 @@ ssize_t elv_iosched_store(struct request_queue *q, const char *name,
1073ssize_t elv_iosched_show(struct request_queue *q, char *name) 1079ssize_t elv_iosched_show(struct request_queue *q, char *name)
1074{ 1080{
1075 struct elevator_queue *e = q->elevator; 1081 struct elevator_queue *e = q->elevator;
1076 struct elevator_type *elv = e->elevator_type; 1082 struct elevator_type *elv;
1077 struct elevator_type *__e; 1083 struct elevator_type *__e;
1078 int len = 0; 1084 int len = 0;
1079 1085
1086 if (!q->elevator)
1087 return sprintf(name, "none\n");
1088
1089 elv = e->elevator_type;
1090
1080 spin_lock(&elv_list_lock); 1091 spin_lock(&elv_list_lock);
1081 list_for_each_entry(__e, &elv_list, list) { 1092 list_for_each_entry(__e, &elv_list, list) {
1082 if (!strcmp(elv->elevator_name, __e->elevator_name)) 1093 if (!strcmp(elv->elevator_name, __e->elevator_name))