aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2009-04-24 02:10:11 -0400
committerJens Axboe <jens.axboe@oracle.com>2009-04-28 01:37:37 -0400
commitc2553b5844b06910435e40cfab9e6f384840cb97 (patch)
tree00a6a1f0c056f19050a8b7c7a1db7b7e0e502062 /block
parent731ec497e5888c6792ad62613ae9be97eebcd7ca (diff)
block: make blk_do_io_stat() do the full "is this rq accountable" checks
We currently check for file system requests outside of blk_do_io_stat(rq), but we may as well just include it. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block')
-rw-r--r--block/blk-core.c12
-rw-r--r--block/blk.h9
2 files changed, 11 insertions, 10 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index 6dd180cf15d2..1e3b97f0ae6e 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -68,7 +68,7 @@ static void drive_stat_acct(struct request *rq, int new_io)
68 int rw = rq_data_dir(rq); 68 int rw = rq_data_dir(rq);
69 int cpu; 69 int cpu;
70 70
71 if (!blk_fs_request(rq) || !blk_do_io_stat(rq)) 71 if (!blk_do_io_stat(rq))
72 return; 72 return;
73 73
74 cpu = part_stat_lock(); 74 cpu = part_stat_lock();
@@ -1639,10 +1639,7 @@ EXPORT_SYMBOL(blkdev_dequeue_request);
1639 1639
1640static void blk_account_io_completion(struct request *req, unsigned int bytes) 1640static void blk_account_io_completion(struct request *req, unsigned int bytes)
1641{ 1641{
1642 if (!blk_do_io_stat(req)) 1642 if (blk_do_io_stat(req)) {
1643 return;
1644
1645 if (blk_fs_request(req)) {
1646 const int rw = rq_data_dir(req); 1643 const int rw = rq_data_dir(req);
1647 struct hd_struct *part; 1644 struct hd_struct *part;
1648 int cpu; 1645 int cpu;
@@ -1656,15 +1653,12 @@ static void blk_account_io_completion(struct request *req, unsigned int bytes)
1656 1653
1657static void blk_account_io_done(struct request *req) 1654static void blk_account_io_done(struct request *req)
1658{ 1655{
1659 if (!blk_do_io_stat(req))
1660 return;
1661
1662 /* 1656 /*
1663 * Account IO completion. bar_rq isn't accounted as a normal 1657 * Account IO completion. bar_rq isn't accounted as a normal
1664 * IO on queueing nor completion. Accounting the containing 1658 * IO on queueing nor completion. Accounting the containing
1665 * request is enough. 1659 * request is enough.
1666 */ 1660 */
1667 if (blk_fs_request(req) && req != &req->q->bar_rq) { 1661 if (blk_do_io_stat(req) && req != &req->q->bar_rq) {
1668 unsigned long duration = jiffies - req->start_time; 1662 unsigned long duration = jiffies - req->start_time;
1669 const int rw = rq_data_dir(req); 1663 const int rw = rq_data_dir(req);
1670 struct hd_struct *part; 1664 struct hd_struct *part;
diff --git a/block/blk.h b/block/blk.h
index 9b2c324e4407..404c10b25ca1 100644
--- a/block/blk.h
+++ b/block/blk.h
@@ -149,9 +149,16 @@ static inline int blk_cpu_to_group(int cpu)
149#endif 149#endif
150} 150}
151 151
152/*
153 * Contribute to IO statistics IFF:
154 *
155 * a) it's attached to a gendisk, and
156 * b) the queue had IO stats enabled when this request was started, and
157 * c) it's a file system request
158 */
152static inline int blk_do_io_stat(struct request *rq) 159static inline int blk_do_io_stat(struct request *rq)
153{ 160{
154 return rq->rq_disk && blk_rq_io_stat(rq); 161 return rq->rq_disk && blk_rq_io_stat(rq) && blk_fs_request(rq);
155} 162}
156 163
157#endif 164#endif