aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 0a0d7c2f2ff6..0bc10cc4b961 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -795,7 +795,7 @@ static void bi_complete(struct bio *bio, int error)
795} 795}
796 796
797int sync_page_io(mdk_rdev_t *rdev, sector_t sector, int size, 797int sync_page_io(mdk_rdev_t *rdev, sector_t sector, int size,
798 struct page *page, int rw) 798 struct page *page, int rw, bool metadata_op)
799{ 799{
800 struct bio *bio = bio_alloc_mddev(GFP_NOIO, 1, rdev->mddev); 800 struct bio *bio = bio_alloc_mddev(GFP_NOIO, 1, rdev->mddev);
801 struct completion event; 801 struct completion event;
@@ -804,7 +804,10 @@ int sync_page_io(mdk_rdev_t *rdev, sector_t sector, int size,
804 rw |= REQ_SYNC | REQ_UNPLUG; 804 rw |= REQ_SYNC | REQ_UNPLUG;
805 805
806 bio->bi_bdev = rdev->bdev; 806 bio->bi_bdev = rdev->bdev;
807 bio->bi_sector = sector; 807 if (metadata_op)
808 bio->bi_sector = sector + rdev->sb_start;
809 else
810 bio->bi_sector = sector + rdev->data_offset;
808 bio_add_page(bio, page, size, 0); 811 bio_add_page(bio, page, size, 0);
809 init_completion(&event); 812 init_completion(&event);
810 bio->bi_private = &event; 813 bio->bi_private = &event;
@@ -829,7 +832,7 @@ static int read_disk_sb(mdk_rdev_t * rdev, int size)
829 return 0; 832 return 0;
830 833
831 834
832 if (!sync_page_io(rdev, rdev->sb_start, size, rdev->sb_page, READ)) 835 if (!sync_page_io(rdev, 0, size, rdev->sb_page, READ, true))
833 goto fail; 836 goto fail;
834 rdev->sb_loaded = 1; 837 rdev->sb_loaded = 1;
835 return 0; 838 return 0;