aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/multipath.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/multipath.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/multipath.c')
-rw-r--r--drivers/md/multipath.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c
index 1151c3ed3006..c06f4474192b 100644
--- a/drivers/md/multipath.c
+++ b/drivers/md/multipath.c
@@ -168,6 +168,7 @@ static int multipath_make_request (request_queue_t *q, struct bio * bio)
168 multipath_conf_t *conf = mddev_to_conf(mddev); 168 multipath_conf_t *conf = mddev_to_conf(mddev);
169 struct multipath_bh * mp_bh; 169 struct multipath_bh * mp_bh;
170 struct multipath_info *multipath; 170 struct multipath_info *multipath;
171 const int rw = bio_data_dir(bio);
171 172
172 if (unlikely(bio_barrier(bio))) { 173 if (unlikely(bio_barrier(bio))) {
173 bio_endio(bio, bio->bi_size, -EOPNOTSUPP); 174 bio_endio(bio, bio->bi_size, -EOPNOTSUPP);
@@ -179,13 +180,8 @@ static int multipath_make_request (request_queue_t *q, struct bio * bio)
179 mp_bh->master_bio = bio; 180 mp_bh->master_bio = bio;
180 mp_bh->mddev = mddev; 181 mp_bh->mddev = mddev;
181 182
182 if (bio_data_dir(bio)==WRITE) { 183 disk_stat_inc(mddev->gendisk, ios[rw]);
183 disk_stat_inc(mddev->gendisk, writes); 184 disk_stat_add(mddev->gendisk, sectors[rw], bio_sectors(bio));
184 disk_stat_add(mddev->gendisk, write_sectors, bio_sectors(bio));
185 } else {
186 disk_stat_inc(mddev->gendisk, reads);
187 disk_stat_add(mddev->gendisk, read_sectors, bio_sectors(bio));
188 }
189 185
190 mp_bh->path = multipath_map(conf); 186 mp_bh->path = multipath_map(conf);
191 if (mp_bh->path < 0) { 187 if (mp_bh->path < 0) {