[BLOCK] Unify the seperate read/write io stat fields into arrays
Instead of having ->read_sectors and ->write_sectors, combine the two into ->sectors[2] and similar for the other fields. This saves a branch several places in the io path, since we don't have to care for what the actual io direction is. On my x86-64 box, that's 200 bytes less text in just the core (not counting the various drivers). Signed-off-by: Jens Axboe <axboe@suse.de>
This commit is contained in:
@ -1462,6 +1462,7 @@ static int make_request (request_queue_t *q, struct bio * bi)
|
||||
sector_t new_sector;
|
||||
sector_t logical_sector, last_sector;
|
||||
struct stripe_head *sh;
|
||||
const int rw = bio_data_dir(bi);
|
||||
|
||||
if (unlikely(bio_barrier(bi))) {
|
||||
bio_endio(bi, bi->bi_size, -EOPNOTSUPP);
|
||||
@ -1470,13 +1471,8 @@ static int make_request (request_queue_t *q, struct bio * bi)
|
||||
|
||||
md_write_start(mddev, bi);
|
||||
|
||||
if (bio_data_dir(bi)==WRITE) {
|
||||
disk_stat_inc(mddev->gendisk, writes);
|
||||
disk_stat_add(mddev->gendisk, write_sectors, bio_sectors(bi));
|
||||
} else {
|
||||
disk_stat_inc(mddev->gendisk, reads);
|
||||
disk_stat_add(mddev->gendisk, read_sectors, bio_sectors(bi));
|
||||
}
|
||||
disk_stat_inc(mddev->gendisk, ios[rw]);
|
||||
disk_stat_add(mddev->gendisk, sectors[rw], bio_sectors(bi));
|
||||
|
||||
logical_sector = bi->bi_sector & ~((sector_t)STRIPE_SECTORS-1);
|
||||
last_sector = bi->bi_sector + (bi->bi_size>>9);
|
||||
|
Reference in New Issue
Block a user