cgroup: fix cgroup_path() vs rename() race
[linux-3.10.git] / block / deadline-iosched.c
index b547cbc..90037b5 100644 (file)
@@ -77,10 +77,8 @@ static void
 deadline_add_rq_rb(struct deadline_data *dd, struct request *rq)
 {
        struct rb_root *root = deadline_rb_root(dd, rq);
-       struct request *__alias;
 
-       while (unlikely(__alias = elv_rb_add(root, rq)))
-               deadline_move_request(dd, __alias);
+       elv_rb_add(root, rq);
 }
 
 static inline void
@@ -232,7 +230,7 @@ static inline int deadline_check_fifo(struct deadline_data *dd, int ddir)
        /*
         * rq is expired!
         */
-       if (time_after(jiffies, rq_fifo_time(rq)))
+       if (time_after_eq(jiffies, rq_fifo_time(rq)))
                return 1;
 
        return 0;
@@ -326,14 +324,6 @@ dispatch_request:
        return 1;
 }
 
-static int deadline_queue_empty(struct request_queue *q)
-{
-       struct deadline_data *dd = q->elevator->elevator_data;
-
-       return list_empty(&dd->fifo_list[WRITE])
-               && list_empty(&dd->fifo_list[READ]);
-}
-
 static void deadline_exit_queue(struct elevator_queue *e)
 {
        struct deadline_data *dd = e->elevator_data;
@@ -347,13 +337,13 @@ static void deadline_exit_queue(struct elevator_queue *e)
 /*
  * initialize elevator private data (deadline_data).
  */
-static void *deadline_init_queue(struct request_queue *q)
+static int deadline_init_queue(struct request_queue *q)
 {
        struct deadline_data *dd;
 
        dd = kmalloc_node(sizeof(*dd), GFP_KERNEL | __GFP_ZERO, q->node);
        if (!dd)
-               return NULL;
+               return -ENOMEM;
 
        INIT_LIST_HEAD(&dd->fifo_list[READ]);
        INIT_LIST_HEAD(&dd->fifo_list[WRITE]);
@@ -364,7 +354,9 @@ static void *deadline_init_queue(struct request_queue *q)
        dd->writes_starved = writes_starved;
        dd->front_merges = 1;
        dd->fifo_batch = fifo_batch;
-       return dd;
+
+       q->elevator->elevator_data = dd;
+       return 0;
 }
 
 /*
@@ -445,7 +437,6 @@ static struct elevator_type iosched_deadline = {
                .elevator_merge_req_fn =        deadline_merged_requests,
                .elevator_dispatch_fn =         deadline_dispatch_requests,
                .elevator_add_req_fn =          deadline_add_request,
-               .elevator_queue_empty_fn =      deadline_queue_empty,
                .elevator_former_req_fn =       elv_rb_former_request,
                .elevator_latter_req_fn =       elv_rb_latter_request,
                .elevator_init_fn =             deadline_init_queue,
@@ -459,9 +450,7 @@ static struct elevator_type iosched_deadline = {
 
 static int __init deadline_init(void)
 {
-       elv_register(&iosched_deadline);
-
-       return 0;
+       return elv_register(&iosched_deadline);
 }
 
 static void __exit deadline_exit(void)