Hi Shaohua, On Wed, Mar 1, 2017 at 7:46 AM, Shaohua Li <shli@xxxxxxxxxx> wrote: > On Tue, Feb 28, 2017 at 11:41:43PM +0800, Ming Lei wrote: >> The cost is 128bytes(8*16) stack space in kernel thread context, and >> just use the bio helper to retrieve pages from bio. >> >> Signed-off-by: Ming Lei <tom.leiming@xxxxxxxxx> >> --- >> drivers/md/raid10.c | 12 ++++++++++-- >> 1 file changed, 10 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c >> index 0b97631e3905..6ffb64ab45f8 100644 >> --- a/drivers/md/raid10.c >> +++ b/drivers/md/raid10.c >> @@ -4670,7 +4670,15 @@ static int handle_reshape_read_error(struct mddev *mddev, >> struct r10bio *r10b = &on_stack.r10_bio; >> int slot = 0; >> int idx = 0; >> - struct bio_vec *bvec = r10_bio->master_bio->bi_io_vec; >> + struct bio_vec *bvl; >> + struct page *pages[RESYNC_PAGES]; >> + >> + /* >> + * This bio is allocated in reshape_request(), and size >> + * is still RESYNC_PAGES >> + */ >> + bio_for_each_segment_all(bvl, r10_bio->master_bio, idx) >> + pages[idx] = bvl->bv_page; > > The reshape bio is doing IO against the memory we allocated for r10_bio, I'm > wondering why we can't get the pages from r10_bio. In this way, we don't need > access the bio_vec any more. Reshap read is special and the bio(r10_bio->master_bio) isn't allocated from .r10buf_pool, please see reshape_request(). Thanks, Ming Lei