summaryrefslogtreecommitdiffstats
path: root/drivers/md/linear.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@suse.de>2005-11-01 09:26:16 +0100
committerJens Axboe <axboe@suse.de>2005-11-01 09:26:16 +0100
commita362357b6cd62643d4dda3b152639303d78473da (patch)
treefe4ce823e638ded151edcb142f28a240860f0d33 /drivers/md/linear.c
parentd72d904a5367ad4ca3f2c9a2ce8c3a68f0b28bf0 (diff)
downloadop-kernel-dev-a362357b6cd62643d4dda3b152639303d78473da.zip
op-kernel-dev-a362357b6cd62643d4dda3b152639303d78473da.tar.gz
[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>
Diffstat (limited to 'drivers/md/linear.c')
-rw-r--r--drivers/md/linear.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/md/linear.c b/drivers/md/linear.c
index bb279fa..946efef 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;
OpenPOWER on IntegriCloud