From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754817AbdBPLrL (ORCPT ); Thu, 16 Feb 2017 06:47:11 -0500 Received: from mail-pg0-f66.google.com ([74.125.83.66]:33617 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754791AbdBPLrH (ORCPT ); Thu, 16 Feb 2017 06:47:07 -0500 From: Ming Lei To: Shaohua Li , Jens Axboe , linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, linux-block@vger.kernel.org, Christoph Hellwig , NeilBrown Cc: Ming Lei Subject: [PATCH 16/17] md: raid10: avoid direct access to bvec table in reshape_request Date: Thu, 16 Feb 2017 19:45:46 +0800 Message-Id: <1487245547-24384-17-git-send-email-tom.leiming@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487245547-24384-1-git-send-email-tom.leiming@gmail.com> References: <1487245547-24384-1-git-send-email-tom.leiming@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/md/raid10.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index c7d2f73565d9..5016ce8163c3 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -4383,6 +4383,8 @@ static sector_t reshape_request(struct mddev *mddev, sector_t sector_nr, struct bio *blist; struct bio *bio, *read_bio; int sectors_done = 0; + struct bio_vec *bvl; + struct page *pages[RESYNC_PAGES]; if (sector_nr == 0) { /* If restarting in the middle, skip the initial sectors */ @@ -4546,9 +4548,12 @@ static sector_t reshape_request(struct mddev *mddev, sector_t sector_nr, /* Now add as many pages as possible to all of these bios. */ + bio_for_each_segment_all(bvl, r10_bio->devs[0].bio, s) + pages[s] = bvl->bv_page; + nr_sectors = 0; for (s = 0 ; s < max_sectors; s += PAGE_SIZE >> 9) { - struct page *page = r10_bio->devs[0].bio->bi_io_vec[s/(PAGE_SIZE>>9)].bv_page; + struct page *page = pages[s / (PAGE_SIZE >> 9)]; int len = (max_sectors - s) << 9; if (len > PAGE_SIZE) len = PAGE_SIZE; -- 2.7.4