From: Rick Lindsley Fix bug #2230. I've corresponded with the submitter and he did find a real bug -- when we were merging I/O requests we didn't always take the oldest request start time, which would cause a couple of the calculations like wait time and average queue size to be too small. He found it mathematically but having done so, I think logic and inspection makes it easy to verify. --- 25-akpm/drivers/block/ll_rw_blk.c | 9 +++++++++ 1 files changed, 9 insertions(+) diff -puN drivers/block/ll_rw_blk.c~iostats-averaging-fix drivers/block/ll_rw_blk.c --- 25/drivers/block/ll_rw_blk.c~iostats-averaging-fix 2004-03-16 00:24:49.861149176 -0800 +++ 25-akpm/drivers/block/ll_rw_blk.c 2004-03-16 00:24:49.864148720 -0800 @@ -2063,6 +2063,15 @@ static int attempt_merge(request_queue_t if (!q->merge_requests_fn(q, req, next)) return 0; + /* + * At this point we have either done a back merge + * or front merge. We need the smaller start_time of + * the merged requests to be the current request + * for accounting purposes. + */ + if (time_after(req->start_time, next->start_time)) + req->start_time = next->start_time; + req->biotail->bi_next = next->bio; req->biotail = next->biotail; _