Something like this make more sense.
diff -Nru a/drivers/block/elevator.c b/drivers/block/elevator.c
--- a/drivers/block/elevator.c Tue May 28 11:33:38 2002
+++ b/drivers/block/elevator.c Tue May 28 11:33:38 2002
@@ -174,21 +174,8 @@
while ((entry = entry->prev) != &q->queue_head) {
__rq = list_entry_rq(entry);
- if (__rq->flags & (REQ_BARRIER | REQ_STARTED))
- break;
-
- /*
- * simply "aging" of requests in queue
- */
- if (elv_linus_sequence(__rq)-- <= 0)
- break;
if (!(__rq->flags & REQ_CMD))
continue;
- if (elv_linus_sequence(__rq) < bio_sectors(bio))
- break;
-
- if (!*req && bio_rq_in_between(bio, __rq, &q->queue_head))
- *req = __rq;
if ((ret = elv_try_merge(__rq, bio))) {
if (ret == ELEVATOR_FRONT_MERGE)
@@ -197,6 +184,15 @@
q->last_merge = &__rq->queuelist;
break;
}
+
+ if (elv_linus_sequence(__rq) < bio_sectors(bio))
+ break;
+
+ if (!*req && bio_rq_in_between(bio, __rq, &q->queue_head))
+ *req = __rq;
+
+ if (__rq->flags & (REQ_BARRIER | REQ_STARTED))
+ break;
}
return ret;
which basically only accounts seeks (sequence is still in sectors but
that doesn't matter). We will always try and merge (don't worry,
rq_mergeable() will check barrier and started bits), the sequence check
is postponed until right before the insertion check.
-- Jens Axboe- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/