From patchwork Thu Feb 16 11:45:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 9576925 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4207F600C5 for ; Thu, 16 Feb 2017 11:47:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3FB08285B7 for ; Thu, 16 Feb 2017 11:47:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 33DB328546; Thu, 16 Feb 2017 11:47:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E8E5228546 for ; Thu, 16 Feb 2017 11:47:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754792AbdBPLrJ (ORCPT ); Thu, 16 Feb 2017 06:47:09 -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 Received: by mail-pg0-f66.google.com with SMTP id 5so1826775pgj.0; Thu, 16 Feb 2017 03:47:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0GthHypuB2H5KywW+3pQmcAv+lHJyMdA/0Etf5krUnM=; b=NG3EY/hYmikgHQx/TMJ3V1/1NSaHsa0MMqBK4bEDLeP37DrSOOV2rQOwL71SN70LdH 6wTsqOEU629AT0ShXBbUQQJr0q2NUPRMajQCdq7f/0aqGNRF+acB6RFEa3SA6TF1aycI XQbORi9F/InHQ5JEfB/fQf9kW/RJD9UY1yKnqfzxsbt8QLhe5nVrv9ozyQTp49TGkq8G 2HC5zwBezHIHZl0bSZe8c/QEMXhsRyiVvAX65FOJcQK5qat7sXVkjOxURE9cMs8Cyafs uiltrrxTg6NxTxdhUrx28soiZEQ92khsNgLzCHD+nfviVN5u42IfxsM/hLWTgfI58AWv S77g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0GthHypuB2H5KywW+3pQmcAv+lHJyMdA/0Etf5krUnM=; b=lrMr9rVMYRo3n2neVIRMKXnrYtpOlW81UWpZ2EDSkMJc6/o4I/Vw/xurTI0le5tSfs r3dR3npQNSqxduj3dEjtifDVb/wOVDydPZMggjQn9/PrlEardaIWGaSb1yomdcxxK/g6 2yLvVjGsa9iGXhnaSNRixx4FVDhtyIwm637pwKrvBwJXvaT0IZ3OCFZkJDBtiKtZLhkS gX4+ahs4fgY35MX6Dx1hawtaeHG6wE8ZbRUSO77AnEb2kWeoV2OTTw0188YmbCEpLEPj kjONjFSMgQkC7FNMcrCiyub2Q/gIufk/qKKbD+QzvOB/Rb635blrWTY4dXGyps09ASPJ 7L9Q== X-Gm-Message-State: AMke39n5S5unswMKf2OVfXW289W2LQ3y6NHcuClBhF+aj3CcBUMoSWYmZGPOQFS6xAKPXw== X-Received: by 10.99.119.200 with SMTP id s191mr2320826pgc.172.1487245622068; Thu, 16 Feb 2017 03:47:02 -0800 (PST) Received: from localhost (li405-222.members.linode.com. [106.187.53.222]) by smtp.gmail.com with ESMTPSA id d63sm13292981pfg.65.2017.02.16.03.47.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Feb 2017 03:47:01 -0800 (PST) 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-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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;