aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/block/Kconfig.iosched28
-rw-r--r--drivers/block/elevator.c27
2 files changed, 38 insertions, 17 deletions
diff --git a/drivers/block/Kconfig.iosched b/drivers/block/Kconfig.iosched
index 6070a480600b..5b90d2fa63b8 100644
--- a/drivers/block/Kconfig.iosched
+++ b/drivers/block/Kconfig.iosched
@@ -38,4 +38,32 @@ config IOSCHED_CFQ
38 among all processes in the system. It should provide a fair 38 among all processes in the system. It should provide a fair
39 working environment, suitable for desktop systems. 39 working environment, suitable for desktop systems.
40 40
41choice
42 prompt "Default I/O scheduler"
43 default DEFAULT_AS
44 help
45 Select the I/O scheduler which will be used by default for all
46 block devices.
47
48 config DEFAULT_AS
49 bool "Anticipatory" if IOSCHED_AS
50
51 config DEFAULT_DEADLINE
52 bool "Deadline" if IOSCHED_DEADLINE
53
54 config DEFAULT_CFQ
55 bool "CFQ" if IOSCHED_CFQ
56
57 config DEFAULT_NOOP
58 bool "No-op"
59
60endchoice
61
62config DEFAULT_IOSCHED
63 string
64 default "anticipatory" if DEFAULT_AS
65 default "deadline" if DEFAULT_DEADLINE
66 default "cfq" if DEFAULT_CFQ
67 default "noop" if DEFAULT_NOOP
68
41endmenu 69endmenu
diff --git a/drivers/block/elevator.c b/drivers/block/elevator.c
index 58e881bfd189..3b652eba2d20 100644
--- a/drivers/block/elevator.c
+++ b/drivers/block/elevator.c
@@ -147,24 +147,17 @@ static void elevator_setup_default(void)
147 struct elevator_type *e; 147 struct elevator_type *e;
148 148
149 /* 149 /*
150 * check if default is set and exists 150 * If default has not been set, use the compiled-in selection.
151 */ 151 */
152 if (chosen_elevator[0] && (e = elevator_get(chosen_elevator))) { 152 if (!chosen_elevator[0])
153 elevator_put(e); 153 strcpy(chosen_elevator, CONFIG_DEFAULT_IOSCHED);
154 return; 154
155 } 155 /*
156 156 * If the given scheduler is not available, fall back to no-op.
157#if defined(CONFIG_IOSCHED_AS) 157 */
158 strcpy(chosen_elevator, "anticipatory"); 158 if (!(e = elevator_find(chosen_elevator)))
159#elif defined(CONFIG_IOSCHED_DEADLINE) 159 strcpy(chosen_elevator, "noop");
160 strcpy(chosen_elevator, "deadline"); 160 elevator_put(e);
161#elif defined(CONFIG_IOSCHED_CFQ)
162 strcpy(chosen_elevator, "cfq");
163#elif defined(CONFIG_IOSCHED_NOOP)
164 strcpy(chosen_elevator, "noop");
165#else
166#error "You must build at least 1 IO scheduler into the kernel"
167#endif
168} 161}
169 162
170static int __init elevator_setup(char *str) 163static int __init elevator_setup(char *str)