elevator: don't sort reads between writes
authorJens Axboe <jens.axboe@oracle.com>
Fri, 19 Jan 2007 00:27:47 +0000 (11:27 +1100)
committerJens Axboe <axboe@carl.home.kernel.dk>
Sun, 11 Feb 2007 22:14:44 +0000 (23:14 +0100)
Don't allow elv_dispatch_sort() to mix reads and writes together,
it's rarely a good idea.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
block/elevator.c

index d03762399147b7caab5ef4ade8afbd64cafa5cb8..25f6ef28e3bb34567db40fb0d8472f39038d0ae5 100644 (file)
@@ -413,6 +413,8 @@ void elv_dispatch_sort(request_queue_t *q, struct request *rq)
        list_for_each_prev(entry, &q->queue_head) {
                struct request *pos = list_entry_rq(entry);
 
+               if (rq_data_dir(rq) != rq_data_dir(pos))
+                       break;
                if (pos->cmd_flags & (REQ_SOFTBARRIER|REQ_HARDBARRIER|REQ_STARTED))
                        break;
                if (rq->sector >= boundary) {