cfq-iosched: make seek_mean converge more quickly
authorJeff Moyer <jmoyer@redhat.com>
Tue, 21 Apr 2009 05:25:04 +0000 (07:25 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Wed, 22 Apr 2009 06:35:11 +0000 (08:35 +0200)
Right now, depending on the first sector to which a process issues I/O,
the seek time may start out way out of whack. So make sure we start
with 0 sectors in seek, instead of the offset of the first request
issued.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
block/cfq-iosched.c

index 0d3b70de3d80e7385d5fce32186819dc4f52e618..0eb4aff9df68dc373b12a28f2dda34546e8770c8 100644 (file)
@@ -1908,7 +1908,9 @@ cfq_update_io_seektime(struct cfq_data *cfqd, struct cfq_io_context *cic,
        sector_t sdist;
        u64 total;
 
-       if (cic->last_request_pos < rq->sector)
+       if (!cic->last_request_pos)
+               sdist = 0;
+       else if (cic->last_request_pos < rq->sector)
                sdist = rq->sector - cic->last_request_pos;
        else
                sdist = cic->last_request_pos - rq->sector;