diff options
author | Tejun Heo <tj@kernel.org> | 2013-01-18 17:05:56 -0500 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2013-01-18 17:05:56 -0500 |
commit | bb813f4c933ae9f887a014483690d5f8b8ec05e1 (patch) | |
tree | 04107b0ae2d1881960dea63b623915db159ecacc /block/elevator.c | |
parent | 84b233adcca3cacd5cfa8013a5feda7a3db4a9af (diff) |
init, block: try to load default elevator module early during boot
This patch adds default module loading and uses it to load the default
block elevator. During boot, it's called right after initramfs or
initrd is made available and right before control is passed to
userland. This ensures that as long as the modules are available in
the usual places in initramfs, initrd or the root filesystem, the
default modules are loaded as soon as possible.
This will replace the on-demand elevator module loading from elevator
init path.
v2: Fixed build breakage when !CONFIG_BLOCK. Reported by kbuild test
robot.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Alex Riesen <raa.lkml@gmail.com>
Cc: Fengguang We <fengguang.wu@intel.com>
Diffstat (limited to 'block/elevator.c')
-rw-r--r-- | block/elevator.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/block/elevator.c b/block/elevator.c index 9edba1b8323e..c2d61d56e0b7 100644 --- a/block/elevator.c +++ b/block/elevator.c | |||
@@ -136,6 +136,22 @@ static int __init elevator_setup(char *str) | |||
136 | 136 | ||
137 | __setup("elevator=", elevator_setup); | 137 | __setup("elevator=", elevator_setup); |
138 | 138 | ||
139 | /* called during boot to load the elevator chosen by the elevator param */ | ||
140 | void __init load_default_elevator_module(void) | ||
141 | { | ||
142 | struct elevator_type *e; | ||
143 | |||
144 | if (!chosen_elevator[0]) | ||
145 | return; | ||
146 | |||
147 | spin_lock(&elv_list_lock); | ||
148 | e = elevator_find(chosen_elevator); | ||
149 | spin_unlock(&elv_list_lock); | ||
150 | |||
151 | if (!e) | ||
152 | request_module("%s-iosched", chosen_elevator); | ||
153 | } | ||
154 | |||
139 | static struct kobj_type elv_ktype; | 155 | static struct kobj_type elv_ktype; |
140 | 156 | ||
141 | static struct elevator_queue *elevator_alloc(struct request_queue *q, | 157 | static struct elevator_queue *elevator_alloc(struct request_queue *q, |