Skip to content

Commit

Permalink
elevator: make elevator_get() attempt to load the appropriate module
Browse files Browse the repository at this point in the history
Currently we fail if someone requests a valid io scheduler, but it's
modular and not currently loaded. That can happen from a driver init
asking for a different scheduler, or online switching through sysfs
as requested by a user.

This patch makes elevator_get() request_module() to attempt to load
the appropriate module, instead of requiring that done manually.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
  • Loading branch information
Jens Axboe committed Feb 19, 2008
1 parent ffc4e75 commit e164094
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions block/elevator.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,21 @@ static struct elevator_type *elevator_get(const char *name)
spin_lock(&elv_list_lock);

e = elevator_find(name);
if (!e) {
char elv[ELV_NAME_MAX + strlen("-iosched")];

spin_unlock(&elv_list_lock);

if (!strcmp(name, "anticipatory"))
sprintf(elv, "as-iosched");
else
sprintf(elv, "%s-iosched", name);

request_module(elv);
spin_lock(&elv_list_lock);
e = elevator_find(name);
}

if (e && !try_module_get(e->elevator_owner))
e = NULL;

Expand Down

0 comments on commit e164094

Please sign in to comment.