mm/mempolicy.c: fix wrong sp_node insertion
[linux-3.10.git] / block / noop-iosched.c
index 1c3de2b..5d1bf70 100644 (file)
@@ -5,19 +5,20 @@
 #include <linux/elevator.h>
 #include <linux/bio.h>
 #include <linux/module.h>
+#include <linux/slab.h>
 #include <linux/init.h>
 
 struct noop_data {
        struct list_head queue;
 };
 
-static void noop_merged_requests(request_queue_t *q, struct request *rq,
+static void noop_merged_requests(struct request_queue *q, struct request *rq,
                                 struct request *next)
 {
        list_del_init(&next->queuelist);
 }
 
-static int noop_dispatch(request_queue_t *q, int force)
+static int noop_dispatch(struct request_queue *q, int force)
 {
        struct noop_data *nd = q->elevator->elevator_data;
 
@@ -31,22 +32,15 @@ static int noop_dispatch(request_queue_t *q, int force)
        return 0;
 }
 
-static void noop_add_request(request_queue_t *q, struct request *rq)
+static void noop_add_request(struct request_queue *q, struct request *rq)
 {
        struct noop_data *nd = q->elevator->elevator_data;
 
        list_add_tail(&rq->queuelist, &nd->queue);
 }
 
-static int noop_queue_empty(request_queue_t *q)
-{
-       struct noop_data *nd = q->elevator->elevator_data;
-
-       return list_empty(&nd->queue);
-}
-
 static struct request *
-noop_former_request(request_queue_t *q, struct request *rq)
+noop_former_request(struct request_queue *q, struct request *rq)
 {
        struct noop_data *nd = q->elevator->elevator_data;
 
@@ -56,7 +50,7 @@ noop_former_request(request_queue_t *q, struct request *rq)
 }
 
 static struct request *
-noop_latter_request(request_queue_t *q, struct request *rq)
+noop_latter_request(struct request_queue *q, struct request *rq)
 {
        struct noop_data *nd = q->elevator->elevator_data;
 
@@ -65,18 +59,20 @@ noop_latter_request(request_queue_t *q, struct request *rq)
        return list_entry(rq->queuelist.next, struct request, queuelist);
 }
 
-static void *noop_init_queue(request_queue_t *q)
+static int noop_init_queue(struct request_queue *q)
 {
        struct noop_data *nd;
 
        nd = kmalloc_node(sizeof(*nd), GFP_KERNEL, q->node);
        if (!nd)
-               return NULL;
+               return -ENOMEM;
+
        INIT_LIST_HEAD(&nd->queue);
-       return nd;
+       q->elevator->elevator_data = nd;
+       return 0;
 }
 
-static void noop_exit_queue(elevator_t *e)
+static void noop_exit_queue(struct elevator_queue *e)
 {
        struct noop_data *nd = e->elevator_data;
 
@@ -89,7 +85,6 @@ static struct elevator_type elevator_noop = {
                .elevator_merge_req_fn          = noop_merged_requests,
                .elevator_dispatch_fn           = noop_dispatch,
                .elevator_add_req_fn            = noop_add_request,
-               .elevator_queue_empty_fn        = noop_queue_empty,
                .elevator_former_req_fn         = noop_former_request,
                .elevator_latter_req_fn         = noop_latter_request,
                .elevator_init_fn               = noop_init_queue,