block: include discard requests in IO accounting
authorJens Axboe <jens.axboe@oracle.com>
Fri, 24 Apr 2009 06:12:19 +0000 (08:12 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Tue, 28 Apr 2009 05:37:37 +0000 (07:37 +0200)
We currently don't do merging on discard requests, but we potentially
could. If we do, then we need to include discard requests in the IO
accounting, or merging would end up decrementing in_flight IO counters
for an IO which never incremented them.

So enable accounting for discard requests.

Problem found by Nikanth Karthikesan <knikanth@suse.de>

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
block/blk.h

index 404c10b..5111559 100644 (file)
@@ -158,7 +158,8 @@ static inline int blk_cpu_to_group(int cpu)
  */
 static inline int blk_do_io_stat(struct request *rq)
 {
-       return rq->rq_disk && blk_rq_io_stat(rq) && blk_fs_request(rq);
+       return rq->rq_disk && blk_rq_io_stat(rq) && blk_fs_request(rq) &&
+               blk_discard_rq(rq);
 }
 
 #endif