From a362357b6cd62643d4dda3b152639303d78473da Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 1 Nov 2005 09:26:16 +0100 Subject: [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 --- drivers/md/linear.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'drivers/md/linear.c') diff --git a/drivers/md/linear.c b/drivers/md/linear.c index bb279fad2fd..946efef3a8f 100644 --- a/drivers/md/linear.c +++ b/drivers/md/linear.c @@ -271,6 +271,7 @@ static int linear_stop (mddev_t *mddev) static int linear_make_request (request_queue_t *q, struct bio *bio) { + const int rw = bio_data_dir(bio); mddev_t *mddev = q->queuedata; dev_info_t *tmp_dev; sector_t block; @@ -280,13 +281,8 @@ static int linear_make_request (request_queue_t *q, struct bio *bio) return 0; } - if (bio_data_dir(bio)==WRITE) { - disk_stat_inc(mddev->gendisk, writes); - disk_stat_add(mddev->gendisk, write_sectors, bio_sectors(bio)); - } else { - disk_stat_inc(mddev->gendisk, reads); - disk_stat_add(mddev->gendisk, read_sectors, bio_sectors(bio)); - } + disk_stat_inc(mddev->gendisk, ios[rw]); + disk_stat_add(mddev->gendisk, sectors[rw], bio_sectors(bio)); tmp_dev = which_dev(mddev, bio->bi_sector); block = bio->bi_sector >> 1; -- cgit v1.2.3