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 <[email protected]>
Cc: Jens Axboe <[email protected]>
Cc: Arjan van de Ven <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Alex Riesen <[email protected]>
Cc: Fengguang We <[email protected]>
This commit is contained in:
Tejun Heo 2013-01-18 14:05:56 -08:00
commit bb813f4c93
6 changed files with 48 additions and 1 deletions

View file

@ -136,6 +136,22 @@ static int __init elevator_setup(char *str)
__setup("elevator=", elevator_setup);
/* called during boot to load the elevator chosen by the elevator param */
void __init load_default_elevator_module(void)
{
struct elevator_type *e;
if (!chosen_elevator[0])
return;
spin_lock(&elv_list_lock);
e = elevator_find(chosen_elevator);
spin_unlock(&elv_list_lock);
if (!e)
request_module("%s-iosched", chosen_elevator);
}
static struct kobj_type elv_ktype;
static struct elevator_queue *elevator_alloc(struct request_queue *q,