Commit 14c781b8 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] iostats averaging fix

From: Rick Lindsley <ricklind@us.ibm.com>

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.
parent 01003a6e
......@@ -2087,6 +2087,15 @@ static int attempt_merge(request_queue_t *q, struct request *req,
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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment