aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/md/raid5.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 4e0f87e462ce..7bbd28546214 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -567,14 +567,6 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s)
567 bi = &sh->dev[i].req; 567 bi = &sh->dev[i].req;
568 rbi = &sh->dev[i].rreq; /* For writing to replacement */ 568 rbi = &sh->dev[i].rreq; /* For writing to replacement */
569 569
570 bi->bi_rw = rw;
571 rbi->bi_rw = rw;
572 if (rw & WRITE) {
573 bi->bi_end_io = raid5_end_write_request;
574 rbi->bi_end_io = raid5_end_write_request;
575 } else
576 bi->bi_end_io = raid5_end_read_request;
577
578 rcu_read_lock(); 570 rcu_read_lock();
579 rrdev = rcu_dereference(conf->disks[i].replacement); 571 rrdev = rcu_dereference(conf->disks[i].replacement);
580 smp_mb(); /* Ensure that if rrdev is NULL, rdev won't be */ 572 smp_mb(); /* Ensure that if rrdev is NULL, rdev won't be */
@@ -649,7 +641,14 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s)
649 641
650 set_bit(STRIPE_IO_STARTED, &sh->state); 642 set_bit(STRIPE_IO_STARTED, &sh->state);
651 643
644 bio_reset(bi);
652 bi->bi_bdev = rdev->bdev; 645 bi->bi_bdev = rdev->bdev;
646 bi->bi_rw = rw;
647 bi->bi_end_io = (rw & WRITE)
648 ? raid5_end_write_request
649 : raid5_end_read_request;
650 bi->bi_private = sh;
651
653 pr_debug("%s: for %llu schedule op %ld on disc %d\n", 652 pr_debug("%s: for %llu schedule op %ld on disc %d\n",
654 __func__, (unsigned long long)sh->sector, 653 __func__, (unsigned long long)sh->sector,
655 bi->bi_rw, i); 654 bi->bi_rw, i);
@@ -663,12 +662,9 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s)
663 if (test_bit(R5_ReadNoMerge, &sh->dev[i].flags)) 662 if (test_bit(R5_ReadNoMerge, &sh->dev[i].flags))
664 bi->bi_rw |= REQ_FLUSH; 663 bi->bi_rw |= REQ_FLUSH;
665 664
666 bi->bi_flags = 1 << BIO_UPTODATE;
667 bi->bi_idx = 0;
668 bi->bi_io_vec[0].bv_len = STRIPE_SIZE; 665 bi->bi_io_vec[0].bv_len = STRIPE_SIZE;
669 bi->bi_io_vec[0].bv_offset = 0; 666 bi->bi_io_vec[0].bv_offset = 0;
670 bi->bi_size = STRIPE_SIZE; 667 bi->bi_size = STRIPE_SIZE;
671 bi->bi_next = NULL;
672 if (rrdev) 668 if (rrdev)
673 set_bit(R5_DOUBLE_LOCKED, &sh->dev[i].flags); 669 set_bit(R5_DOUBLE_LOCKED, &sh->dev[i].flags);
674 trace_block_bio_remap(bdev_get_queue(bi->bi_bdev), 670 trace_block_bio_remap(bdev_get_queue(bi->bi_bdev),
@@ -683,7 +679,13 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s)
683 679
684 set_bit(STRIPE_IO_STARTED, &sh->state); 680 set_bit(STRIPE_IO_STARTED, &sh->state);
685 681
682 bio_reset(rbi);
686 rbi->bi_bdev = rrdev->bdev; 683 rbi->bi_bdev = rrdev->bdev;
684 rbi->bi_rw = rw;
685 BUG_ON(!(rw & WRITE));
686 rbi->bi_end_io = raid5_end_write_request;
687 rbi->bi_private = sh;
688
687 pr_debug("%s: for %llu schedule op %ld on " 689 pr_debug("%s: for %llu schedule op %ld on "
688 "replacement disc %d\n", 690 "replacement disc %d\n",
689 __func__, (unsigned long long)sh->sector, 691 __func__, (unsigned long long)sh->sector,
@@ -695,12 +697,9 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s)
695 else 697 else
696 rbi->bi_sector = (sh->sector 698 rbi->bi_sector = (sh->sector
697 + rrdev->data_offset); 699 + rrdev->data_offset);
698 rbi->bi_flags = 1 << BIO_UPTODATE;
699 rbi->bi_idx = 0;
700 rbi->bi_io_vec[0].bv_len = STRIPE_SIZE; 700 rbi->bi_io_vec[0].bv_len = STRIPE_SIZE;
701 rbi->bi_io_vec[0].bv_offset = 0; 701 rbi->bi_io_vec[0].bv_offset = 0;
702 rbi->bi_size = STRIPE_SIZE; 702 rbi->bi_size = STRIPE_SIZE;
703 rbi->bi_next = NULL;
704 trace_block_bio_remap(bdev_get_queue(rbi->bi_bdev), 703 trace_block_bio_remap(bdev_get_queue(rbi->bi_bdev),
705 rbi, disk_devt(conf->mddev->gendisk), 704 rbi, disk_devt(conf->mddev->gendisk),
706 sh->dev[i].sector); 705 sh->dev[i].sector);