Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 19081
b: refs/heads/master
c: 5f00397
h: refs/heads/master
i:
  19079: 1100c31
v: v3
  • Loading branch information
Nate Diller authored and Jens Axboe committed Jan 24, 2006
1 parent 236a23a commit e3d126b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 32 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 53e86061b5bd4aece9bbb6b00b30720200596ecb
refs/heads/master: 5f00397644e01adfbebafb5d0ebc01eba522709d
45 changes: 14 additions & 31 deletions trunk/block/elevator.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,35 +139,16 @@ static int elevator_attach(request_queue_t *q, struct elevator_type *e,

static char chosen_elevator[16];

static void elevator_setup_default(void)
static int __init elevator_setup(char *str)
{
struct elevator_type *e;

/*
* If default has not been set, use the compiled-in selection.
*/
if (!chosen_elevator[0])
strcpy(chosen_elevator, CONFIG_DEFAULT_IOSCHED);

/*
* Be backwards-compatible with previous kernels, so users
* won't get the wrong elevator.
*/
if (!strcmp(chosen_elevator, "as"))
if (!strcmp(str, "as"))
strcpy(chosen_elevator, "anticipatory");

/*
* If the given scheduler is not available, fall back to the default
*/
if ((e = elevator_find(chosen_elevator)))
elevator_put(e);
else
strcpy(chosen_elevator, CONFIG_DEFAULT_IOSCHED);
}

static int __init elevator_setup(char *str)
{
strncpy(chosen_elevator, str, sizeof(chosen_elevator) - 1);
strncpy(chosen_elevator, str, sizeof(chosen_elevator) - 1);
return 0;
}

Expand All @@ -184,15 +165,15 @@ int elevator_init(request_queue_t *q, char *name)
q->end_sector = 0;
q->boundary_rq = NULL;

elevator_setup_default();

if (!name)
name = chosen_elevator;

e = elevator_get(name);
if (!e)
if (name && !(e = elevator_get(name)))
return -EINVAL;

if (!e && !(e = elevator_get(chosen_elevator))) {
e = elevator_get(CONFIG_DEFAULT_IOSCHED);
if (*chosen_elevator)
printk("I/O scheduler %s not found\n", chosen_elevator);
}

eq = kmalloc(sizeof(struct elevator_queue), GFP_KERNEL);
if (!eq) {
elevator_put(e);
Expand Down Expand Up @@ -669,8 +650,10 @@ int elv_register(struct elevator_type *e)
spin_unlock_irq(&elv_list_lock);

printk(KERN_INFO "io scheduler %s registered", e->elevator_name);
if (!strcmp(e->elevator_name, chosen_elevator))
printk(" (default)");
if (!strcmp(e->elevator_name, chosen_elevator) ||
(!*chosen_elevator &&
!strcmp(e->elevator_name, CONFIG_DEFAULT_IOSCHED)))
printk(" (default)");
printk("\n");
return 0;
}
Expand Down

0 comments on commit e3d126b

Please sign in to comment.