diff options
author | Jens Axboe <axboe@suse.de> | 2005-11-01 03:26:16 -0500 |
---|---|---|
committer | Jens Axboe <axboe@suse.de> | 2005-11-01 03:26:16 -0500 |
commit | a362357b6cd62643d4dda3b152639303d78473da (patch) | |
tree | fe4ce823e638ded151edcb142f28a240860f0d33 /drivers/md/raid1.c | |
parent | d72d904a5367ad4ca3f2c9a2ce8c3a68f0b28bf0 (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/raid1.c')
-rw-r--r-- | drivers/md/raid1.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 0e1f148dd41d..e16f473bcf46 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -647,6 +647,7 @@ static int make_request(request_queue_t *q, struct bio * bio) | |||
647 | unsigned long flags; | 647 | unsigned long flags; |
648 | struct bio_list bl; | 648 | struct bio_list bl; |
649 | struct page **behind_pages = NULL; | 649 | struct page **behind_pages = NULL; |
650 | const int rw = bio_data_dir(bio); | ||
650 | 651 | ||
651 | if (unlikely(bio_barrier(bio))) { | 652 | if (unlikely(bio_barrier(bio))) { |
652 | bio_endio(bio, bio->bi_size, -EOPNOTSUPP); | 653 | bio_endio(bio, bio->bi_size, -EOPNOTSUPP); |
@@ -665,13 +666,8 @@ static int make_request(request_queue_t *q, struct bio * bio) | |||
665 | conf->nr_pending++; | 666 | conf->nr_pending++; |
666 | spin_unlock_irq(&conf->resync_lock); | 667 | spin_unlock_irq(&conf->resync_lock); |
667 | 668 | ||
668 | if (bio_data_dir(bio)==WRITE) { | 669 | disk_stat_inc(mddev->gendisk, ios[rw]); |
669 | disk_stat_inc(mddev->gendisk, writes); | 670 | disk_stat_add(mddev->gendisk, sectors[rw], bio_sectors(bio)); |
670 | disk_stat_add(mddev->gendisk, write_sectors, bio_sectors(bio)); | ||
671 | } else { | ||
672 | disk_stat_inc(mddev->gendisk, reads); | ||
673 | disk_stat_add(mddev->gendisk, read_sectors, bio_sectors(bio)); | ||
674 | } | ||
675 | 671 | ||
676 | /* | 672 | /* |
677 | * make_request() can abort the operation when READA is being | 673 | * make_request() can abort the operation when READA is being |
@@ -686,7 +682,7 @@ static int make_request(request_queue_t *q, struct bio * bio) | |||
686 | r1_bio->mddev = mddev; | 682 | r1_bio->mddev = mddev; |
687 | r1_bio->sector = bio->bi_sector; | 683 | r1_bio->sector = bio->bi_sector; |
688 | 684 | ||
689 | if (bio_data_dir(bio) == READ) { | 685 | if (rw == READ) { |
690 | /* | 686 | /* |
691 | * read balancing logic: | 687 | * read balancing logic: |
692 | */ | 688 | */ |