aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2005-11-02 11:06:02 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-02 11:06:02 -0500
commitec1890c5df451799dec969a3581ff72e1934b5ee (patch)
tree38e84a95297dc9c6b727b73925d5c273d110fdbe /drivers
parentca23509fbaac0ea662ab0e287bebb72f743f9e1f (diff)
parent496456c24f1f4280d50b81aa5bf439ab440b3d7e (diff)
Merge git://brick.kernel.dk/data/git/linux-2.6-block
Diffstat (limited to 'drivers')
-rw-r--r--drivers/block/aoe/aoecmd.c13
-rw-r--r--drivers/block/genhd.c29
-rw-r--r--drivers/block/ll_rw_blk.c47
-rw-r--r--drivers/md/linear.c10
-rw-r--r--drivers/md/md.c4
-rw-r--r--drivers/md/multipath.c10
-rw-r--r--drivers/md/raid0.c10
-rw-r--r--drivers/md/raid1.c12
-rw-r--r--drivers/md/raid10.c12
-rw-r--r--drivers/md/raid5.c10
-rw-r--r--drivers/md/raid6main.c12
11 files changed, 61 insertions, 108 deletions
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c
index 5c9c7c1a3d4c..326ca3876b68 100644
--- a/drivers/block/aoe/aoecmd.c
+++ b/drivers/block/aoe/aoecmd.c
@@ -468,16 +468,11 @@ aoecmd_ata_rsp(struct sk_buff *skb)
468 unsigned long duration = jiffies - buf->start_time; 468 unsigned long duration = jiffies - buf->start_time;
469 unsigned long n_sect = buf->bio->bi_size >> 9; 469 unsigned long n_sect = buf->bio->bi_size >> 9;
470 struct gendisk *disk = d->gd; 470 struct gendisk *disk = d->gd;
471 const int rw = bio_data_dir(buf->bio);
471 472
472 if (bio_data_dir(buf->bio) == WRITE) { 473 disk_stat_inc(disk, ios[rw]);
473 disk_stat_inc(disk, writes); 474 disk_stat_add(disk, ticks[rw], duration);
474 disk_stat_add(disk, write_ticks, duration); 475 disk_stat_add(disk, sectors[rw], n_sect);
475 disk_stat_add(disk, write_sectors, n_sect);
476 } else {
477 disk_stat_inc(disk, reads);
478 disk_stat_add(disk, read_ticks, duration);
479 disk_stat_add(disk, read_sectors, n_sect);
480 }
481 disk_stat_add(disk, io_ticks, duration); 476 disk_stat_add(disk, io_ticks, duration);
482 n = (buf->flags & BUFFL_FAIL) ? -EIO : 0; 477 n = (buf->flags & BUFFL_FAIL) ? -EIO : 0;
483 bio_endio(buf->bio, buf->bio->bi_size, n); 478 bio_endio(buf->bio, buf->bio->bi_size, n);
diff --git a/drivers/block/genhd.c b/drivers/block/genhd.c
index 486ce1fdeb8c..54aec4a1ae13 100644
--- a/drivers/block/genhd.c
+++ b/drivers/block/genhd.c
@@ -391,13 +391,12 @@ static ssize_t disk_stats_read(struct gendisk * disk, char *page)
391 "%8u %8u %8llu %8u " 391 "%8u %8u %8llu %8u "
392 "%8u %8u %8u" 392 "%8u %8u %8u"
393 "\n", 393 "\n",
394 disk_stat_read(disk, reads), disk_stat_read(disk, read_merges), 394 disk_stat_read(disk, ios[0]), disk_stat_read(disk, merges[0]),
395 (unsigned long long)disk_stat_read(disk, read_sectors), 395 (unsigned long long)disk_stat_read(disk, sectors[0]),
396 jiffies_to_msecs(disk_stat_read(disk, read_ticks)), 396 jiffies_to_msecs(disk_stat_read(disk, ticks[0])),
397 disk_stat_read(disk, writes), 397 disk_stat_read(disk, ios[1]), disk_stat_read(disk, merges[1]),
398 disk_stat_read(disk, write_merges), 398 (unsigned long long)disk_stat_read(disk, sectors[1]),
399 (unsigned long long)disk_stat_read(disk, write_sectors), 399 jiffies_to_msecs(disk_stat_read(disk, ticks[1])),
400 jiffies_to_msecs(disk_stat_read(disk, write_ticks)),
401 disk->in_flight, 400 disk->in_flight,
402 jiffies_to_msecs(disk_stat_read(disk, io_ticks)), 401 jiffies_to_msecs(disk_stat_read(disk, io_ticks)),
403 jiffies_to_msecs(disk_stat_read(disk, time_in_queue))); 402 jiffies_to_msecs(disk_stat_read(disk, time_in_queue)));
@@ -583,12 +582,12 @@ static int diskstats_show(struct seq_file *s, void *v)
583 preempt_enable(); 582 preempt_enable();
584 seq_printf(s, "%4d %4d %s %u %u %llu %u %u %u %llu %u %u %u %u\n", 583 seq_printf(s, "%4d %4d %s %u %u %llu %u %u %u %llu %u %u %u %u\n",
585 gp->major, n + gp->first_minor, disk_name(gp, n, buf), 584 gp->major, n + gp->first_minor, disk_name(gp, n, buf),
586 disk_stat_read(gp, reads), disk_stat_read(gp, read_merges), 585 disk_stat_read(gp, ios[0]), disk_stat_read(gp, merges[0]),
587 (unsigned long long)disk_stat_read(gp, read_sectors), 586 (unsigned long long)disk_stat_read(gp, sectors[0]),
588 jiffies_to_msecs(disk_stat_read(gp, read_ticks)), 587 jiffies_to_msecs(disk_stat_read(gp, ticks[0])),
589 disk_stat_read(gp, writes), disk_stat_read(gp, write_merges), 588 disk_stat_read(gp, ios[1]), disk_stat_read(gp, merges[1]),
590 (unsigned long long)disk_stat_read(gp, write_sectors), 589 (unsigned long long)disk_stat_read(gp, sectors[1]),
591 jiffies_to_msecs(disk_stat_read(gp, write_ticks)), 590 jiffies_to_msecs(disk_stat_read(gp, ticks[1])),
592 gp->in_flight, 591 gp->in_flight,
593 jiffies_to_msecs(disk_stat_read(gp, io_ticks)), 592 jiffies_to_msecs(disk_stat_read(gp, io_ticks)),
594 jiffies_to_msecs(disk_stat_read(gp, time_in_queue))); 593 jiffies_to_msecs(disk_stat_read(gp, time_in_queue)));
@@ -601,8 +600,8 @@ static int diskstats_show(struct seq_file *s, void *v)
601 seq_printf(s, "%4d %4d %s %u %u %u %u\n", 600 seq_printf(s, "%4d %4d %s %u %u %u %u\n",
602 gp->major, n + gp->first_minor + 1, 601 gp->major, n + gp->first_minor + 1,
603 disk_name(gp, n + 1, buf), 602 disk_name(gp, n + 1, buf),
604 hd->reads, hd->read_sectors, 603 hd->ios[0], hd->sectors[0],
605 hd->writes, hd->write_sectors); 604 hd->ios[1], hd->sectors[1]);
606 } 605 }
607 606
608 return 0; 607 return 0;
diff --git a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c
index 0af73512b9a8..2747741677fb 100644
--- a/drivers/block/ll_rw_blk.c
+++ b/drivers/block/ll_rw_blk.c
@@ -2387,16 +2387,9 @@ static void drive_stat_acct(struct request *rq, int nr_sectors, int new_io)
2387 if (!blk_fs_request(rq) || !rq->rq_disk) 2387 if (!blk_fs_request(rq) || !rq->rq_disk)
2388 return; 2388 return;
2389 2389
2390 if (rw == READ) { 2390 if (!new_io) {
2391 __disk_stat_add(rq->rq_disk, read_sectors, nr_sectors); 2391 __disk_stat_inc(rq->rq_disk, merges[rw]);
2392 if (!new_io) 2392 } else {
2393 __disk_stat_inc(rq->rq_disk, read_merges);
2394 } else if (rw == WRITE) {
2395 __disk_stat_add(rq->rq_disk, write_sectors, nr_sectors);
2396 if (!new_io)
2397 __disk_stat_inc(rq->rq_disk, write_merges);
2398 }
2399 if (new_io) {
2400 disk_round_stats(rq->rq_disk); 2393 disk_round_stats(rq->rq_disk);
2401 rq->rq_disk->in_flight++; 2394 rq->rq_disk->in_flight++;
2402 } 2395 }
@@ -2791,17 +2784,11 @@ static inline void blk_partition_remap(struct bio *bio)
2791 2784
2792 if (bdev != bdev->bd_contains) { 2785 if (bdev != bdev->bd_contains) {
2793 struct hd_struct *p = bdev->bd_part; 2786 struct hd_struct *p = bdev->bd_part;
2787 const int rw = bio_data_dir(bio);
2788
2789 p->sectors[rw] += bio_sectors(bio);
2790 p->ios[rw]++;
2794 2791
2795 switch (bio_data_dir(bio)) {
2796 case READ:
2797 p->read_sectors += bio_sectors(bio);
2798 p->reads++;
2799 break;
2800 case WRITE:
2801 p->write_sectors += bio_sectors(bio);
2802 p->writes++;
2803 break;
2804 }
2805 bio->bi_sector += p->start_sect; 2792 bio->bi_sector += p->start_sect;
2806 bio->bi_bdev = bdev->bd_contains; 2793 bio->bi_bdev = bdev->bd_contains;
2807 } 2794 }
@@ -3048,6 +3035,12 @@ static int __end_that_request_first(struct request *req, int uptodate,
3048 (unsigned long long)req->sector); 3035 (unsigned long long)req->sector);
3049 } 3036 }
3050 3037
3038 if (blk_fs_request(req) && req->rq_disk) {
3039 const int rw = rq_data_dir(req);
3040
3041 __disk_stat_add(req->rq_disk, sectors[rw], nr_bytes >> 9);
3042 }
3043
3051 total_bytes = bio_nbytes = 0; 3044 total_bytes = bio_nbytes = 0;
3052 while ((bio = req->bio) != NULL) { 3045 while ((bio = req->bio) != NULL) {
3053 int nbytes; 3046 int nbytes;
@@ -3176,16 +3169,10 @@ void end_that_request_last(struct request *req)
3176 3169
3177 if (disk && blk_fs_request(req)) { 3170 if (disk && blk_fs_request(req)) {
3178 unsigned long duration = jiffies - req->start_time; 3171 unsigned long duration = jiffies - req->start_time;
3179 switch (rq_data_dir(req)) { 3172 const int rw = rq_data_dir(req);
3180 case WRITE: 3173
3181 __disk_stat_inc(disk, writes); 3174 __disk_stat_inc(disk, ios[rw]);
3182 __disk_stat_add(disk, write_ticks, duration); 3175 __disk_stat_add(disk, ticks[rw], duration);
3183 break;
3184 case READ:
3185 __disk_stat_inc(disk, reads);
3186 __disk_stat_add(disk, read_ticks, duration);
3187 break;
3188 }
3189 disk_round_stats(disk); 3176 disk_round_stats(disk);
3190 disk->in_flight--; 3177 disk->in_flight--;
3191 } 3178 }
diff --git a/drivers/md/linear.c b/drivers/md/linear.c
index bb279fad2fd2..946efef3a8f5 100644
--- a/drivers/md/linear.c
+++ b/drivers/md/linear.c
@@ -271,6 +271,7 @@ static int linear_stop (mddev_t *mddev)
271 271
272static int linear_make_request (request_queue_t *q, struct bio *bio) 272static int linear_make_request (request_queue_t *q, struct bio *bio)
273{ 273{
274 const int rw = bio_data_dir(bio);
274 mddev_t *mddev = q->queuedata; 275 mddev_t *mddev = q->queuedata;
275 dev_info_t *tmp_dev; 276 dev_info_t *tmp_dev;
276 sector_t block; 277 sector_t block;
@@ -280,13 +281,8 @@ static int linear_make_request (request_queue_t *q, struct bio *bio)
280 return 0; 281 return 0;
281 } 282 }
282 283
283 if (bio_data_dir(bio)==WRITE) { 284 disk_stat_inc(mddev->gendisk, ios[rw]);
284 disk_stat_inc(mddev->gendisk, writes); 285 disk_stat_add(mddev->gendisk, sectors[rw], bio_sectors(bio));
285 disk_stat_add(mddev->gendisk, write_sectors, bio_sectors(bio));
286 } else {
287 disk_stat_inc(mddev->gendisk, reads);
288 disk_stat_add(mddev->gendisk, read_sectors, bio_sectors(bio));
289 }
290 286
291 tmp_dev = which_dev(mddev, bio->bi_sector); 287 tmp_dev = which_dev(mddev, bio->bi_sector);
292 block = bio->bi_sector >> 1; 288 block = bio->bi_sector >> 1;
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 2a8a5696bf8a..9ecf51ee596f 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -3466,8 +3466,8 @@ static int is_mddev_idle(mddev_t *mddev)
3466 idle = 1; 3466 idle = 1;
3467 ITERATE_RDEV(mddev,rdev,tmp) { 3467 ITERATE_RDEV(mddev,rdev,tmp) {
3468 struct gendisk *disk = rdev->bdev->bd_contains->bd_disk; 3468 struct gendisk *disk = rdev->bdev->bd_contains->bd_disk;
3469 curr_events = disk_stat_read(disk, read_sectors) + 3469 curr_events = disk_stat_read(disk, sectors[0]) +
3470 disk_stat_read(disk, write_sectors) - 3470 disk_stat_read(disk, sectors[1]) -
3471 atomic_read(&disk->sync_io); 3471 atomic_read(&disk->sync_io);
3472 /* Allow some slack between valud of curr_events and last_events, 3472 /* Allow some slack between valud of curr_events and last_events,
3473 * as there are some uninteresting races. 3473 * as there are some uninteresting races.
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) {
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index f6757259ce7f..fece3277c2a5 100644
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -403,19 +403,15 @@ static int raid0_make_request (request_queue_t *q, struct bio *bio)
403 mdk_rdev_t *tmp_dev; 403 mdk_rdev_t *tmp_dev;
404 unsigned long chunk; 404 unsigned long chunk;
405 sector_t block, rsect; 405 sector_t block, rsect;
406 const int rw = bio_data_dir(bio);
406 407
407 if (unlikely(bio_barrier(bio))) { 408 if (unlikely(bio_barrier(bio))) {
408 bio_endio(bio, bio->bi_size, -EOPNOTSUPP); 409 bio_endio(bio, bio->bi_size, -EOPNOTSUPP);
409 return 0; 410 return 0;
410 } 411 }
411 412
412 if (bio_data_dir(bio)==WRITE) { 413 disk_stat_inc(mddev->gendisk, ios[rw]);
413 disk_stat_inc(mddev->gendisk, writes); 414 disk_stat_add(mddev->gendisk, sectors[rw], bio_sectors(bio));
414 disk_stat_add(mddev->gendisk, write_sectors, bio_sectors(bio));
415 } else {
416 disk_stat_inc(mddev->gendisk, reads);
417 disk_stat_add(mddev->gendisk, read_sectors, bio_sectors(bio));
418 }
419 415
420 chunk_size = mddev->chunk_size >> 10; 416 chunk_size = mddev->chunk_size >> 10;
421 chunk_sects = mddev->chunk_size >> 9; 417 chunk_sects = mddev->chunk_size >> 9;
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 */
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 */
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 4683ca24c046..6497295ebfb9 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -1462,6 +1462,7 @@ static int make_request (request_queue_t *q, struct bio * bi)
1462 sector_t new_sector; 1462 sector_t new_sector;
1463 sector_t logical_sector, last_sector; 1463 sector_t logical_sector, last_sector;
1464 struct stripe_head *sh; 1464 struct stripe_head *sh;
1465 const int rw = bio_data_dir(bi);
1465 1466
1466 if (unlikely(bio_barrier(bi))) { 1467 if (unlikely(bio_barrier(bi))) {
1467 bio_endio(bi, bi->bi_size, -EOPNOTSUPP); 1468 bio_endio(bi, bi->bi_size, -EOPNOTSUPP);
@@ -1470,13 +1471,8 @@ static int make_request (request_queue_t *q, struct bio * bi)
1470 1471
1471 md_write_start(mddev, bi); 1472 md_write_start(mddev, bi);
1472 1473
1473 if (bio_data_dir(bi)==WRITE) { 1474 disk_stat_inc(mddev->gendisk, ios[rw]);
1474 disk_stat_inc(mddev->gendisk, writes); 1475 disk_stat_add(mddev->gendisk, sectors[rw], bio_sectors(bi));
1475 disk_stat_add(mddev->gendisk, write_sectors, bio_sectors(bi));
1476 } else {
1477 disk_stat_inc(mddev->gendisk, reads);
1478 disk_stat_add(mddev->gendisk, read_sectors, bio_sectors(bi));
1479 }
1480 1476
1481 logical_sector = bi->bi_sector & ~((sector_t)STRIPE_SECTORS-1); 1477 logical_sector = bi->bi_sector & ~((sector_t)STRIPE_SECTORS-1);
1482 last_sector = bi->bi_sector + (bi->bi_size>>9); 1478 last_sector = bi->bi_sector + (bi->bi_size>>9);
diff --git a/drivers/md/raid6main.c b/drivers/md/raid6main.c
index 267eb1430c83..6437a95ffc1c 100644
--- a/drivers/md/raid6main.c
+++ b/drivers/md/raid6main.c
@@ -1621,6 +1621,7 @@ static int make_request (request_queue_t *q, struct bio * bi)
1621 sector_t new_sector; 1621 sector_t new_sector;
1622 sector_t logical_sector, last_sector; 1622 sector_t logical_sector, last_sector;
1623 struct stripe_head *sh; 1623 struct stripe_head *sh;
1624 const int rw = bio_data_dir(bi);
1624 1625
1625 if (unlikely(bio_barrier(bi))) { 1626 if (unlikely(bio_barrier(bi))) {
1626 bio_endio(bi, bi->bi_size, -EOPNOTSUPP); 1627 bio_endio(bi, bi->bi_size, -EOPNOTSUPP);
@@ -1629,13 +1630,8 @@ static int make_request (request_queue_t *q, struct bio * bi)
1629 1630
1630 md_write_start(mddev, bi); 1631 md_write_start(mddev, bi);
1631 1632
1632 if (bio_data_dir(bi)==WRITE) { 1633 disk_stat_inc(mddev->gendisk, ios[rw]);
1633 disk_stat_inc(mddev->gendisk, writes); 1634 disk_stat_add(mddev->gendisk, sectors[rw], bio_sectors(bi));
1634 disk_stat_add(mddev->gendisk, write_sectors, bio_sectors(bi));
1635 } else {
1636 disk_stat_inc(mddev->gendisk, reads);
1637 disk_stat_add(mddev->gendisk, read_sectors, bio_sectors(bi));
1638 }
1639 1635
1640 logical_sector = bi->bi_sector & ~((sector_t)STRIPE_SECTORS-1); 1636 logical_sector = bi->bi_sector & ~((sector_t)STRIPE_SECTORS-1);
1641 last_sector = bi->bi_sector + (bi->bi_size>>9); 1637 last_sector = bi->bi_sector + (bi->bi_size>>9);
@@ -1682,7 +1678,7 @@ static int make_request (request_queue_t *q, struct bio * bi)
1682 if (--bi->bi_phys_segments == 0) { 1678 if (--bi->bi_phys_segments == 0) {
1683 int bytes = bi->bi_size; 1679 int bytes = bi->bi_size;
1684 1680
1685 if ( bio_data_dir(bi) == WRITE ) 1681 if (rw == WRITE )
1686 md_write_end(mddev); 1682 md_write_end(mddev);
1687 bi->bi_size = 0; 1683 bi->bi_size = 0;
1688 bi->bi_end_io(bi, bytes, 0); 1684 bi->bi_end_io(bi, bytes, 0);