aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJens Axboe <axboe@suse.de>2005-11-01 02:35:42 -0500
committerJens Axboe <axboe@suse.de>2005-11-01 02:35:42 -0500
commitd72d904a5367ad4ca3f2c9a2ce8c3a68f0b28bf0 (patch)
treeb41aaa3ceb0aa40090adda140d143e72fd16d587 /drivers
parentd83c671fb7023f69a9582e622d01525054f23b66 (diff)
[BLOCK] Update read/write block io statistics at completion time
Right now we do it at queueing time, which works alright for reads (since they are usually sync), but not for async writes since we can queue io a lot faster than we can complete it. This makes the vmstat output look extremely bursty. Signed-off-by: Jens Axboe <axboe@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/block/ll_rw_blk.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c
index 0af73512b9a8..1b272883aadf 100644
--- a/drivers/block/ll_rw_blk.c
+++ b/drivers/block/ll_rw_blk.c
@@ -2387,16 +2387,12 @@ static void drive_stat_acct(struct request *rq, int nr_sectors, int new_io)
2387 if (!blk_fs_request(rq) || !rq->rq_disk) 2387 if (!blk_fs_request(rq) || !rq->rq_disk)
2388 return; 2388 return;
2389 2389
2390 if (rw == READ) { 2390 if (!new_io) {
2391 __disk_stat_add(rq->rq_disk, read_sectors, nr_sectors); 2391 if (rw == READ)
2392 if (!new_io)
2393 __disk_stat_inc(rq->rq_disk, read_merges); 2392 __disk_stat_inc(rq->rq_disk, read_merges);
2394 } else if (rw == WRITE) { 2393 else
2395 __disk_stat_add(rq->rq_disk, write_sectors, nr_sectors);
2396 if (!new_io)
2397 __disk_stat_inc(rq->rq_disk, write_merges); 2394 __disk_stat_inc(rq->rq_disk, write_merges);
2398 } 2395 } else {
2399 if (new_io) {
2400 disk_round_stats(rq->rq_disk); 2396 disk_round_stats(rq->rq_disk);
2401 rq->rq_disk->in_flight++; 2397 rq->rq_disk->in_flight++;
2402 } 2398 }
@@ -3048,6 +3044,13 @@ static int __end_that_request_first(struct request *req, int uptodate,
3048 (unsigned long long)req->sector); 3044 (unsigned long long)req->sector);
3049 } 3045 }
3050 3046
3047 if (blk_fs_request(req) && req->rq_disk) {
3048 if (rq_data_dir(req) == READ)
3049 __disk_stat_add(req->rq_disk, read_sectors, nr_bytes >> 9);
3050 else
3051 __disk_stat_add(req->rq_disk, write_sectors, nr_bytes >> 9);
3052 }
3053
3051 total_bytes = bio_nbytes = 0; 3054 total_bytes = bio_nbytes = 0;
3052 while ((bio = req->bio) != NULL) { 3055 while ((bio = req->bio) != NULL) {
3053 int nbytes; 3056 int nbytes;