[PATCH 2/2][RESEND] Default iosched fixes (was: Fall back io scheduler for 2.6.15?)

From: Nate Diller
Date: Fri Jan 20 2006 - 18:23:24 EST


Jens has decided that allowing the default scheduler to be a module is
a bug, and should not be allowed under kconfig. However, I find that
scenario useful for debugging, and wish for the kernel to be able to
handle this situation without OOPSing, if I enable such an option in
the .config directly. This patch dynamically checks for the presence
of the compiled-in default, and falls back to no-op, emitting a
suitable error message, when the default is not available

Tested for a range of boot options on 2.6.16-rc1-mm2.

Signed-off-by: Nate Diller <nate.diller@xxxxxxxxx>

--- ./block/elevator.c 2006-01-20 14:52:53.000000000 -0800
+++ ./block/elevator.c 2006-01-20 15:00:16.000000000 -0800
@@ -169,10 +169,12 @@ int elevator_init(request_queue_t *q, ch
if (name && !(e = elevator_get(name)))
return -EINVAL;

- if (!e && !(e = elevator_get(chosen_elevator))) {
- e = elevator_get(CONFIG_DEFAULT_IOSCHED);
- if (*chosen_elevator)
- printk("I/O scheduler %s not found\n", chosen_elevator);
+ if (!e && *chosen_elevator && !(e = elevator_get(chosen_elevator)))
+ printk("I/O scheduler %s not found\n", chosen_elevator);
+
+ 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);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/