if (!blk_fs_request(rq) || !rq->rq_disk)
return;
- if (rw == READ) {
- __disk_stat_add(rq->rq_disk, read_sectors, nr_sectors);
- if (!new_io)
+ if (!new_io) {
+ if (rw == READ)
__disk_stat_inc(rq->rq_disk, read_merges);
- } else if (rw == WRITE) {
- __disk_stat_add(rq->rq_disk, write_sectors, nr_sectors);
- if (!new_io)
+ else
__disk_stat_inc(rq->rq_disk, write_merges);
- }
- if (new_io) {
+ } else {
disk_round_stats(rq->rq_disk);
rq->rq_disk->in_flight++;
}
(unsigned long long)req->sector);
}
+ if (blk_fs_request(req) && req->rq_disk) {
+ if (rq_data_dir(req) == READ)
+ __disk_stat_add(req->rq_disk, read_sectors, nr_bytes >> 9);
+ else
+ __disk_stat_add(req->rq_disk, write_sectors, nr_bytes >> 9);
+ }
+
total_bytes = bio_nbytes = 0;
while ((bio = req->bio) != NULL) {
int nbytes;