aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-core.c
diff options
context:
space:
mode:
authorJerome Marchand <jmarchan@redhat.com>2009-03-27 05:31:51 -0400
committerJens Axboe <jens.axboe@oracle.com>2009-04-07 02:12:38 -0400
commit26308eab69aa193f7b3fb50764a64ae14544a39b (patch)
tree758f6100395a23228d042c3a9d6f7dc1922d7530 /block/blk-core.c
parent6c7e8cee6a9128eeb7f83c3ad1cb243f77f5cb16 (diff)
block: fix inconsistency in I/O stat accounting code
This forces in_flight to be zero when turning off or on the I/O stat accounting and stops updating I/O stats in attempt_merge() when accounting is turned off. Signed-off-by: Jerome Marchand <jmarchan@redhat.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block/blk-core.c')
-rw-r--r--block/blk-core.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index 25572802dac..3688abff243 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -64,12 +64,11 @@ static struct workqueue_struct *kblockd_workqueue;
64 64
65static void drive_stat_acct(struct request *rq, int new_io) 65static void drive_stat_acct(struct request *rq, int new_io)
66{ 66{
67 struct gendisk *disk = rq->rq_disk;
68 struct hd_struct *part; 67 struct hd_struct *part;
69 int rw = rq_data_dir(rq); 68 int rw = rq_data_dir(rq);
70 int cpu; 69 int cpu;
71 70
72 if (!blk_fs_request(rq) || !disk || !blk_do_io_stat(disk->queue)) 71 if (!blk_fs_request(rq) || !blk_do_io_stat(rq))
73 return; 72 return;
74 73
75 cpu = part_stat_lock(); 74 cpu = part_stat_lock();
@@ -1675,9 +1674,7 @@ EXPORT_SYMBOL(blkdev_dequeue_request);
1675 1674
1676static void blk_account_io_completion(struct request *req, unsigned int bytes) 1675static void blk_account_io_completion(struct request *req, unsigned int bytes)
1677{ 1676{
1678 struct gendisk *disk = req->rq_disk; 1677 if (!blk_do_io_stat(req))
1679
1680 if (!disk || !blk_do_io_stat(disk->queue))
1681 return; 1678 return;
1682 1679
1683 if (blk_fs_request(req)) { 1680 if (blk_fs_request(req)) {
@@ -1694,9 +1691,7 @@ static void blk_account_io_completion(struct request *req, unsigned int bytes)
1694 1691
1695static void blk_account_io_done(struct request *req) 1692static void blk_account_io_done(struct request *req)
1696{ 1693{
1697 struct gendisk *disk = req->rq_disk; 1694 if (!blk_do_io_stat(req))
1698
1699 if (!disk || !blk_do_io_stat(disk->queue))
1700 return; 1695 return;
1701 1696
1702 /* 1697 /*
@@ -1711,7 +1706,7 @@ static void blk_account_io_done(struct request *req)
1711 int cpu; 1706 int cpu;
1712 1707
1713 cpu = part_stat_lock(); 1708 cpu = part_stat_lock();
1714 part = disk_map_sector_rcu(disk, req->sector); 1709 part = disk_map_sector_rcu(req->rq_disk, req->sector);
1715 1710
1716 part_stat_inc(cpu, part, ios[rw]); 1711 part_stat_inc(cpu, part, ios[rw]);
1717 part_stat_add(cpu, part, ticks[rw], duration); 1712 part_stat_add(cpu, part, ticks[rw], duration);