Commit 60928a91 authored by Ming Lei's avatar Ming Lei Committed by Shaohua Li

md: raid1: use bio helper in process_checks()

Avoid to direct access to bvec table.
Signed-off-by: default avatarMing Lei <tom.leiming@gmail.com>
Signed-off-by: default avatarShaohua Li <shli@fb.com>
parent 44cf0f4d
...@@ -2111,6 +2111,7 @@ static void process_checks(struct r1bio *r1_bio) ...@@ -2111,6 +2111,7 @@ static void process_checks(struct r1bio *r1_bio)
int j; int j;
int size; int size;
int error; int error;
struct bio_vec *bi;
struct bio *b = r1_bio->bios[i]; struct bio *b = r1_bio->bios[i];
struct resync_pages *rp = get_resync_pages(b); struct resync_pages *rp = get_resync_pages(b);
if (b->bi_end_io != end_sync_read) if (b->bi_end_io != end_sync_read)
...@@ -2129,9 +2130,7 @@ static void process_checks(struct r1bio *r1_bio) ...@@ -2129,9 +2130,7 @@ static void process_checks(struct r1bio *r1_bio)
b->bi_private = rp; b->bi_private = rp;
size = b->bi_iter.bi_size; size = b->bi_iter.bi_size;
for (j = 0; j < vcnt ; j++) { bio_for_each_segment_all(bi, b, j) {
struct bio_vec *bi;
bi = &b->bi_io_vec[j];
bi->bv_offset = 0; bi->bv_offset = 0;
if (size > PAGE_SIZE) if (size > PAGE_SIZE)
bi->bv_len = PAGE_SIZE; bi->bv_len = PAGE_SIZE;
...@@ -2155,17 +2154,22 @@ static void process_checks(struct r1bio *r1_bio) ...@@ -2155,17 +2154,22 @@ static void process_checks(struct r1bio *r1_bio)
int error = sbio->bi_error; int error = sbio->bi_error;
struct page **ppages = get_resync_pages(pbio)->pages; struct page **ppages = get_resync_pages(pbio)->pages;
struct page **spages = get_resync_pages(sbio)->pages; struct page **spages = get_resync_pages(sbio)->pages;
struct bio_vec *bi;
int page_len[RESYNC_PAGES];
if (sbio->bi_end_io != end_sync_read) if (sbio->bi_end_io != end_sync_read)
continue; continue;
/* Now we can 'fixup' the error value */ /* Now we can 'fixup' the error value */
sbio->bi_error = 0; sbio->bi_error = 0;
bio_for_each_segment_all(bi, sbio, j)
page_len[j] = bi->bv_len;
if (!error) { if (!error) {
for (j = vcnt; j-- ; ) { for (j = vcnt; j-- ; ) {
if (memcmp(page_address(ppages[j]), if (memcmp(page_address(ppages[j]),
page_address(spages[j]), page_address(spages[j]),
sbio->bi_io_vec[j].bv_len)) page_len[j]))
break; break;
} }
} else } else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment