]> git.hungrycats.org Git - linux/commitdiff
[PATCH] setup queue before elevator_init()
authorJens Axboe <axboe@suse.de>
Thu, 12 Aug 2004 02:27:27 +0000 (19:27 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Thu, 12 Aug 2004 02:27:27 +0000 (19:27 -0700)
We must setup the queue before calling elevator_init(), otherwise the
elevator cannot use the queue members. This really hurts cfq since it
checks ->nr_requests, which is zero at that time.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/block/ll_rw_blk.c

index 8dc40d5d86daa819f2fe4e702cc54e3216017f0d..17c403ebd58bbf65cadfd323a1f00aa6b5f04732 100644 (file)
@@ -1467,9 +1467,6 @@ request_queue_t *blk_init_queue(request_fn_proc *rfn, spinlock_t *lock)
                printk("Using %s io scheduler\n", chosen_elevator->elevator_name);
        }
 
-       if (elevator_init(q, chosen_elevator))
-               goto out_elv;
-
        q->request_fn           = rfn;
        q->back_merge_fn        = ll_back_merge_fn;
        q->front_merge_fn       = ll_front_merge_fn;
@@ -1487,8 +1484,12 @@ request_queue_t *blk_init_queue(request_fn_proc *rfn, spinlock_t *lock)
        blk_queue_max_hw_segments(q, MAX_HW_SEGMENTS);
        blk_queue_max_phys_segments(q, MAX_PHYS_SEGMENTS);
 
-       return q;
-out_elv:
+       /*
+        * all done
+        */
+       if (!elevator_init(q, chosen_elevator))
+               return q;
+
        blk_cleanup_queue(q);
 out_init:
        kmem_cache_free(requestq_cachep, q);