diff options
Diffstat (limited to 'block/noop-iosched.c')
| -rw-r--r-- | block/noop-iosched.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/block/noop-iosched.c b/block/noop-iosched.c index 06389e9ef96..3de89d4690f 100644 --- a/block/noop-iosched.c +++ b/block/noop-iosched.c @@ -59,15 +59,28 @@ noop_latter_request(struct request_queue *q, struct request *rq) return list_entry(rq->queuelist.next, struct request, queuelist); } -static void *noop_init_queue(struct request_queue *q) +static int noop_init_queue(struct request_queue *q, struct elevator_type *e) { struct noop_data *nd; + struct elevator_queue *eq; + + eq = elevator_alloc(q, e); + if (!eq) + return -ENOMEM; nd = kmalloc_node(sizeof(*nd), GFP_KERNEL, q->node); - if (!nd) - return NULL; + if (!nd) { + kobject_put(&eq->kobj); + return -ENOMEM; + } + eq->elevator_data = nd; + INIT_LIST_HEAD(&nd->queue); - return nd; + + spin_lock_irq(q->queue_lock); + q->elevator = eq; + spin_unlock_irq(q->queue_lock); + return 0; } static void noop_exit_queue(struct elevator_queue *e) @@ -94,9 +107,7 @@ static struct elevator_type elevator_noop = { static int __init noop_init(void) { - elv_register(&elevator_noop); - - return 0; + return elv_register(&elevator_noop); } static void __exit noop_exit(void) |
