summaryrefslogtreecommitdiffstats
path: root/block/elevator.c
diff options
context:
space:
mode:
authorAdrian Bunk <bunk@stusta.de>2006-02-03 23:49:49 +0100
committerAdrian Bunk <bunk@r063144.stusta.swh.mhn.de>2006-02-03 23:49:49 +0100
commit01d206a7c1167639f6ca6dac22140fbdca017558 (patch)
treebc3ccf1a8140a7f787c4728cfa4c30e65ad56eb2 /block/elevator.c
parent9c4b562abc9005e4b413de02c85d3d29da707cba (diff)
parentd6c8f6aaa1d7f68c1e6471ab0839d9047cdd159f (diff)
downloadkernel-crypto-01d206a7c1167639f6ca6dac22140fbdca017558.tar.gz
kernel-crypto-01d206a7c1167639f6ca6dac22140fbdca017558.tar.xz
kernel-crypto-01d206a7c1167639f6ca6dac22140fbdca017558.zip
Merge with git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Diffstat (limited to 'block/elevator.c')
-rw-r--r--block/elevator.c45
1 files changed, 15 insertions, 30 deletions
diff --git a/block/elevator.c b/block/elevator.c
index c9f424d5399..96a61e029ce 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -139,35 +139,16 @@ static int elevator_attach(request_queue_t *q, struct elevator_type *e,
static char chosen_elevator[16];
-static void elevator_setup_default(void)
+static int __init elevator_setup(char *str)
{
- struct elevator_type *e;
-
- /*
- * If default has not been set, use the compiled-in selection.
- */
- if (!chosen_elevator[0])
- strcpy(chosen_elevator, CONFIG_DEFAULT_IOSCHED);
-
/*
* Be backwards-compatible with previous kernels, so users
* won't get the wrong elevator.
*/
- if (!strcmp(chosen_elevator, "as"))
+ if (!strcmp(str, "as"))
strcpy(chosen_elevator, "anticipatory");
-
- /*
- * If the given scheduler is not available, fall back to the default
- */
- if ((e = elevator_find(chosen_elevator)))
- elevator_put(e);
else
- strcpy(chosen_elevator, CONFIG_DEFAULT_IOSCHED);
-}
-
-static int __init elevator_setup(char *str)
-{
- strncpy(chosen_elevator, str, sizeof(chosen_elevator) - 1);
+ strncpy(chosen_elevator, str, sizeof(chosen_elevator) - 1);
return 0;
}
@@ -184,14 +165,16 @@ int elevator_init(request_queue_t *q, char *name)
q->end_sector = 0;
q->boundary_rq = NULL;
- elevator_setup_default();
+ if (name && !(e = elevator_get(name)))
+ return -EINVAL;
- if (!name)
- name = chosen_elevator;
+ if (!e && *chosen_elevator && !(e = elevator_get(chosen_elevator)))
+ printk("I/O scheduler %s not found\n", chosen_elevator);
- e = elevator_get(name);
- if (!e)
- return -EINVAL;
+ if (!e && !(e = elevator_get(CONFIG_DEFAULT_IOSCHED))) {
+ printk("Default I/O scheduler not found, using no-op\n");
+ e = elevator_get("noop");
+ }
eq = kmalloc(sizeof(struct elevator_queue), GFP_KERNEL);
if (!eq) {
@@ -669,8 +652,10 @@ int elv_register(struct elevator_type *e)
spin_unlock_irq(&elv_list_lock);
printk(KERN_INFO "io scheduler %s registered", e->elevator_name);
- if (!strcmp(e->elevator_name, chosen_elevator))
- printk(" (default)");
+ if (!strcmp(e->elevator_name, chosen_elevator) ||
+ (!*chosen_elevator &&
+ !strcmp(e->elevator_name, CONFIG_DEFAULT_IOSCHED)))
+ printk(" (default)");
printk("\n");
return 0;
}