]> err.no Git - linux-2.6/commitdiff
[PATCH] block cleanups: Add kconfig default iosched submenu
authorNate Diller <nate@namesys.com>
Sun, 30 Oct 2005 23:02:19 +0000 (15:02 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 31 Oct 2005 01:37:20 +0000 (17:37 -0800)
Add a kconfig submenu to select the default I/O scheduler, in case
anticipatory is not compiled in or another default is preferred.  Also,
since no-op is always available, we should use it whenever the selected
default is not.

Signed-off-by: Nate Diller <nate@namesys.com>
Acked-by: Jens Axboe <axboe@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/block/Kconfig.iosched
drivers/block/elevator.c

index 6070a480600b6ba2e24902e70a48a71290faaf7c..5b90d2fa63b8382d80de600d0410e4a1cf0518e2 100644 (file)
@@ -38,4 +38,32 @@ config IOSCHED_CFQ
          among all processes in the system. It should provide a fair
          working environment, suitable for desktop systems.
 
+choice
+       prompt "Default I/O scheduler"
+       default DEFAULT_AS
+       help
+         Select the I/O scheduler which will be used by default for all
+         block devices.
+
+       config DEFAULT_AS
+               bool "Anticipatory" if IOSCHED_AS
+
+       config DEFAULT_DEADLINE
+               bool "Deadline" if IOSCHED_DEADLINE
+
+       config DEFAULT_CFQ
+               bool "CFQ" if IOSCHED_CFQ
+
+       config DEFAULT_NOOP
+               bool "No-op"
+
+endchoice
+
+config DEFAULT_IOSCHED
+       string
+       default "anticipatory" if DEFAULT_AS
+       default "deadline" if DEFAULT_DEADLINE
+       default "cfq" if DEFAULT_CFQ
+       default "noop" if DEFAULT_NOOP
+
 endmenu
index 58e881bfd189ad4a677bc02e8d8b71663cb7e351..3b652eba2d206c872e1e1c1b3ac6be1554a3ebd0 100644 (file)
@@ -147,24 +147,17 @@ static void elevator_setup_default(void)
        struct elevator_type *e;
 
        /*
-        * check if default is set and exists
+        * If default has not been set, use the compiled-in selection.
         */
-       if (chosen_elevator[0] && (e = elevator_get(chosen_elevator))) {
-               elevator_put(e);
-               return;
-       }
-
-#if defined(CONFIG_IOSCHED_AS)
-       strcpy(chosen_elevator, "anticipatory");
-#elif defined(CONFIG_IOSCHED_DEADLINE)
-       strcpy(chosen_elevator, "deadline");
-#elif defined(CONFIG_IOSCHED_CFQ)
-       strcpy(chosen_elevator, "cfq");
-#elif defined(CONFIG_IOSCHED_NOOP)
-       strcpy(chosen_elevator, "noop");
-#else
-#error "You must build at least 1 IO scheduler into the kernel"
-#endif
+       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)