--- 2.4.0-test3-pre8/drivers/block/ll_rw_blk.c Tue Jul 11 21:52:55 2000 +++ elevator/drivers/block/ll_rw_blk.c Tue Jul 11 23:34:28 2000 @@ -583,7 +583,7 @@ int max_segments = MAX_SEGMENTS; struct request * req = NULL; int rw_ahead, max_sectors, el_ret; - struct list_head *head; + struct list_head *head = &q->queue_head; int latency; elevator_t *elevator = &q->elevator; @@ -669,7 +669,6 @@ /* * skip first entry, for devices with active queue head */ - head = &q->queue_head; if (q->head_active && !q->plugged) head = head->next; @@ -731,9 +730,11 @@ req = __get_request_wait(q, rw); spin_lock_irq(&io_request_lock); - head = &q->queue_head; - if (q->head_active && !q->plugged) - head = head->next; + if (q->head_active) { + head = &q->queue_head; + if (!q->plugged) + head = head->next; + } } /* fill up the request-info, and add it to the queue */ --- 2.4.0-test3-pre8/drivers/block/elevator.c Tue Jul 11 21:52:55 2000 +++ elevator/drivers/block/elevator.c Tue Jul 11 23:37:53 2000 @@ -140,17 +140,12 @@ req->elevator_sequence = orig_latency; - if (list_empty(real_head)) { - list_add(&req->queue, real_head); - return; - } - while ((entry = entry->prev) != head) { tmp = blkdev_entry_to_request(entry); - if (!tmp->elevator_sequence) - break; if (IN_ORDER(tmp, req)) break; + if (!tmp->elevator_sequence) + break; tmp->elevator_sequence--; } list_add(&req->queue, entry); @@ -169,8 +164,6 @@ while ((entry = entry->prev) != head) { struct request *__rq = *req = blkdev_entry_to_request(entry); - if (!__rq->elevator_sequence) - break; if (__rq->sem) continue; if (__rq->cmd != rw) @@ -183,7 +176,10 @@ ret = ELEVATOR_BACK_MERGE; break; } + if (!__rq->elevator_sequence) + break; if (__rq->sector - count == bh->b_rsector) { + __rq->elevator_sequence--; ret = ELEVATOR_FRONT_MERGE; break;