From: Nate Diller <nate.diller@gmail.com>
To: Jens Axboe <axboe@suse.de>
Cc: Andrew Morton <akpm@osdl.org>,
cmm@us.ibm.com, seelam@cs.utep.edu, linux-kernel@vger.kernel.org,
ext2-devel@lists.sourceforge.net
Subject: [PATCH] Default iosched fixes (was: Fall back io scheduler for 2.6.15?)
Date: Thu, 19 Jan 2006 16:04:06 -0800 [thread overview]
Message-ID: <5c49b0ed0601191604p4fa53404r783b3a703e922b13@mail.gmail.com> (raw)
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;
next reply other threads:[~2006-01-20 0:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-20 0:04 Nate Diller [this message]
2006-01-20 8:11 ` Jens Axboe
2006-01-20 23:17 ` [PATCH 1/2][RESEND] " Nate Diller
2006-01-20 23:24 ` [PATCH 2/2][RESEND] " Nate Diller
2006-01-21 11:40 ` Jens Axboe
2006-01-21 11:48 ` [PATCH 1/2][RESEND] " Jens Axboe
2006-01-23 19:50 ` Nate Diller
2006-01-23 21:02 ` Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5c49b0ed0601191604p4fa53404r783b3a703e922b13@mail.gmail.com \
--to=nate.diller@gmail.com \
--cc=akpm@osdl.org \
--cc=axboe@suse.de \
--cc=cmm@us.ibm.com \
--cc=ext2-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=seelam@cs.utep.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®