Messages in this thread Patch in this message | | | Date | Thu, 19 Jan 2006 16:04:06 -0800 | From | Nate Diller <> | Subject | [PATCH] Default iosched fixes (was: Fall back io scheduler for 2.6.15?) |
| |
My previous default iosched patch did a poor job dealing with the 'elevator=' boot-time option. Jens' recent solution would fail if the selected default were compiled as a module, and I find that scenario useful for debugging. This patch dynamically evaluates which default to use, and emits suitable error messages when the requested scheduler is not available. It also indicates the compiled-in default scheduler at registration time, and includes a version of Chuck Ebbert's 'as' -> 'anticipatory' compatability patch.
Tested for a range of boot options on 2.6.13-rc5-mm1, should apply to any recent kernel.
Signed-off-by: Nate Diller <nate.diller@gmail.com>
--- drivers/block/elevator.c 2006-01-19 15:01:03.000000000 -0800 +++ drivers/block/elevator.c 2006-01-19 15:03:22.000000000 -0800 @@ -153,27 +153,16 @@ static int elevator_attach(request_queue
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. + * Be backwards-compatible with previous kernels, so users + * won't get the wrong scheduler. */ - if (!chosen_elevator[0]) - strcpy(chosen_elevator, CONFIG_DEFAULT_IOSCHED); - - /* - * If the given scheduler is not available, fall back to no-op. - */ - if (!(e = elevator_find(chosen_elevator))) - strcpy(chosen_elevator, "noop"); - elevator_put(e); -} - -static int __init elevator_setup(char *str) -{ - strncpy(chosen_elevator, str, sizeof(chosen_elevator) - 1); + if (!strcmp(str, "as")) + strcpy(chosen_elevator, "anticipatory"); + else + strncpy(chosen_elevator, str, sizeof(chosen_elevator) - 1); return 0; }
@@ -185,14 +174,16 @@ int elevator_init(request_queue_t *q, ch struct elevator_queue *eq; int ret = 0;
- elevator_setup_default(); + if (name && !(e = elevator_get(name))) + return -EINVAL;
- if (!name) - name = chosen_elevator; + if (!e && chosen_elevator[0] && !(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))) { + e = elevator_get("noop"); + printk("Default I/O scheduler not found, using no-op\n"); + }
eq = kmalloc(sizeof(struct elevator_queue), GFP_KERNEL); if (!eq) { @@ -566,7 +557,9 @@ 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)) + if (!strcmp(e->elevator_name, chosen_elevator) || + (!chosen_elevator[0] && + !strcmp(e->elevator_name, CONFIG_DEFAULT_IOSCHED))) printk(" (default)"); printk("\n"); return 0; - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |