aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid10.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@suse.de>2005-11-01 03:26:16 -0500
committerJens Axboe <axboe@suse.de>2005-11-01 03:26:16 -0500
commita362357b6cd62643d4dda3b152639303d78473da (patch)
treefe4ce823e638ded151edcb142f28a240860f0d33 /drivers/md/raid10.c
parentd72d904a5367ad4ca3f2c9a2ce8c3a68f0b28bf0 (diff)
[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/raid10.c')
-rw-r--r--drivers/md/raid10.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 28dd028415e4..bbe40e9cf923 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -668,6 +668,7 @@ static int make_request(request_queue_t *q, struct bio * bio)
668 struct bio *read_bio; 668 struct bio *read_bio;
669 int i; 669 int i;
670 int chunk_sects = conf->chunk_mask + 1; 670 int chunk_sects = conf->chunk_mask + 1;
671 const int rw = bio_data_dir(bio);
671 672
672 if (unlikely(bio_barrier(bio))) { 673 if (unlikely(bio_barrier(bio))) {
673 bio_endio(bio, bio->bi_size, -EOPNOTSUPP); 674 bio_endio(bio, bio->bi_size, -EOPNOTSUPP);
@@ -718,13 +719,8 @@ static int make_request(request_queue_t *q, struct bio * bio)
718 conf->nr_pending++; 719 conf->nr_pending++;
719 spin_unlock_irq(&conf->resync_lock); 720 spin_unlock_irq(&conf->resync_lock);
720 721
721 if (bio_data_dir(bio)==WRITE) { 722 disk_stat_inc(mddev->gendisk, ios[rw]);
722 disk_stat_inc(mddev->gendisk, writes); 723 disk_stat_add(mddev->gendisk, sectors[rw], bio_sectors(bio));
723 disk_stat_add(mddev->gendisk, write_sectors, bio_sectors(bio));
724 } else {
725 disk_stat_inc(mddev->gendisk, reads);
726 disk_stat_add(mddev->gendisk, read_sectors, bio_sectors(bio));
727 }
728 724
729 r10_bio = mempool_alloc(conf->r10bio_pool, GFP_NOIO); 725 r10_bio = mempool_alloc(conf->r10bio_pool, GFP_NOIO);
730 726
@@ -734,7 +730,7 @@ static int make_request(request_queue_t *q, struct bio * bio)
734 r10_bio->mddev = mddev; 730 r10_bio->mddev = mddev;
735 r10_bio->sector = bio->bi_sector; 731 r10_bio->sector = bio->bi_sector;
736 732
737 if (bio_data_dir(bio) == READ) { 733 if (rw == READ) {
738 /* 734 /*
739 * read balancing logic: 735 * read balancing logic:
740 */ 736 */