aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid1.c
diff options
context:
space:
mode:
authorMing Lei <tom.leiming@gmail.com>2017-03-16 12:12:27 -0400
committerShaohua Li <shli@fb.com>2017-03-24 13:41:36 -0400
commit44cf0f4dc76b5e44e6a9c727be6902434f99a9bd (patch)
tree179b270c2f3da836efa5f3d980dfbc3288564b98 /drivers/md/raid1.c
parent98d30c5812c343c970b5997369b4f6b197c29b3d (diff)
md: raid1: retrieve page from pre-allocated resync page array
Now one page array is allocated for each resync bio, and we can retrieve page from this table directly. Signed-off-by: Ming Lei <tom.leiming@gmail.com> Signed-off-by: Shaohua Li <shli@fb.com>
Diffstat (limited to 'drivers/md/raid1.c')
-rw-r--r--drivers/md/raid1.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 89a384bdae29..21ef09ae5123 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1973,6 +1973,7 @@ static int fix_sync_read_error(struct r1bio *r1_bio)
1973 struct mddev *mddev = r1_bio->mddev; 1973 struct mddev *mddev = r1_bio->mddev;
1974 struct r1conf *conf = mddev->private; 1974 struct r1conf *conf = mddev->private;
1975 struct bio *bio = r1_bio->bios[r1_bio->read_disk]; 1975 struct bio *bio = r1_bio->bios[r1_bio->read_disk];
1976 struct page **pages = get_resync_pages(bio)->pages;
1976 sector_t sect = r1_bio->sector; 1977 sector_t sect = r1_bio->sector;
1977 int sectors = r1_bio->sectors; 1978 int sectors = r1_bio->sectors;
1978 int idx = 0; 1979 int idx = 0;
@@ -2006,7 +2007,7 @@ static int fix_sync_read_error(struct r1bio *r1_bio)
2006 */ 2007 */
2007 rdev = conf->mirrors[d].rdev; 2008 rdev = conf->mirrors[d].rdev;
2008 if (sync_page_io(rdev, sect, s<<9, 2009 if (sync_page_io(rdev, sect, s<<9,
2009 bio->bi_io_vec[idx].bv_page, 2010 pages[idx],
2010 REQ_OP_READ, 0, false)) { 2011 REQ_OP_READ, 0, false)) {
2011 success = 1; 2012 success = 1;
2012 break; 2013 break;
@@ -2061,7 +2062,7 @@ static int fix_sync_read_error(struct r1bio *r1_bio)
2061 continue; 2062 continue;
2062 rdev = conf->mirrors[d].rdev; 2063 rdev = conf->mirrors[d].rdev;
2063 if (r1_sync_page_io(rdev, sect, s, 2064 if (r1_sync_page_io(rdev, sect, s,
2064 bio->bi_io_vec[idx].bv_page, 2065 pages[idx],
2065 WRITE) == 0) { 2066 WRITE) == 0) {
2066 r1_bio->bios[d]->bi_end_io = NULL; 2067 r1_bio->bios[d]->bi_end_io = NULL;
2067 rdev_dec_pending(rdev, mddev); 2068 rdev_dec_pending(rdev, mddev);
@@ -2076,7 +2077,7 @@ static int fix_sync_read_error(struct r1bio *r1_bio)
2076 continue; 2077 continue;
2077 rdev = conf->mirrors[d].rdev; 2078 rdev = conf->mirrors[d].rdev;
2078 if (r1_sync_page_io(rdev, sect, s, 2079 if (r1_sync_page_io(rdev, sect, s,
2079 bio->bi_io_vec[idx].bv_page, 2080 pages[idx],
2080 READ) != 0) 2081 READ) != 0)
2081 atomic_add(s, &rdev->corrected_errors); 2082 atomic_add(s, &rdev->corrected_errors);
2082 } 2083 }
@@ -2152,6 +2153,8 @@ static void process_checks(struct r1bio *r1_bio)
2152 struct bio *pbio = r1_bio->bios[primary]; 2153 struct bio *pbio = r1_bio->bios[primary];
2153 struct bio *sbio = r1_bio->bios[i]; 2154 struct bio *sbio = r1_bio->bios[i];
2154 int error = sbio->bi_error; 2155 int error = sbio->bi_error;
2156 struct page **ppages = get_resync_pages(pbio)->pages;
2157 struct page **spages = get_resync_pages(sbio)->pages;
2155 2158
2156 if (sbio->bi_end_io != end_sync_read) 2159 if (sbio->bi_end_io != end_sync_read)
2157 continue; 2160 continue;
@@ -2160,11 +2163,8 @@ static void process_checks(struct r1bio *r1_bio)
2160 2163
2161 if (!error) { 2164 if (!error) {
2162 for (j = vcnt; j-- ; ) { 2165 for (j = vcnt; j-- ; ) {
2163 struct page *p, *s; 2166 if (memcmp(page_address(ppages[j]),
2164 p = pbio->bi_io_vec[j].bv_page; 2167 page_address(spages[j]),
2165 s = sbio->bi_io_vec[j].bv_page;
2166 if (memcmp(page_address(p),
2167 page_address(s),
2168 sbio->bi_io_vec[j].bv_len)) 2168 sbio->bi_io_vec[j].bv_len))
2169 break; 2169 break;
2170 } 2170 }