diff options
author | Ming Lei <tom.leiming@gmail.com> | 2017-03-17 00:12:28 +0800 |
---|---|---|
committer | Shaohua Li <shli@fb.com> | 2017-03-24 10:41:36 -0700 |
commit | 60928a91b0b3beca4a1cf2739118f967c783f79a (patch) | |
tree | c0d6a951816e3d0f0b5bc3e71004fcbeb2f0ea71 /drivers/md/raid1.c | |
parent | 44cf0f4dc76b5e44e6a9c727be6902434f99a9bd (diff) | |
download | lwn-60928a91b0b3beca4a1cf2739118f967c783f79a.tar.gz lwn-60928a91b0b3beca4a1cf2739118f967c783f79a.zip |
md: raid1: use bio helper in process_checks()
Avoid to direct access to bvec table.
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.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 21ef09ae5123..d27b84666884 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -2111,6 +2111,7 @@ static void process_checks(struct r1bio *r1_bio) int j; int size; int error; + struct bio_vec *bi; struct bio *b = r1_bio->bios[i]; struct resync_pages *rp = get_resync_pages(b); if (b->bi_end_io != end_sync_read) @@ -2129,9 +2130,7 @@ static void process_checks(struct r1bio *r1_bio) b->bi_private = rp; size = b->bi_iter.bi_size; - for (j = 0; j < vcnt ; j++) { - struct bio_vec *bi; - bi = &b->bi_io_vec[j]; + bio_for_each_segment_all(bi, b, j) { bi->bv_offset = 0; if (size > PAGE_SIZE) bi->bv_len = PAGE_SIZE; @@ -2155,17 +2154,22 @@ static void process_checks(struct r1bio *r1_bio) int error = sbio->bi_error; struct page **ppages = get_resync_pages(pbio)->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) continue; /* Now we can 'fixup' the error value */ sbio->bi_error = 0; + bio_for_each_segment_all(bi, sbio, j) + page_len[j] = bi->bv_len; + if (!error) { for (j = vcnt; j-- ; ) { if (memcmp(page_address(ppages[j]), page_address(spages[j]), - sbio->bi_io_vec[j].bv_len)) + page_len[j])) break; } } else |