From patchwork Thu Feb 16 11:45:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 9576929 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 52BD0600C5 for ; Thu, 16 Feb 2017 11:48:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 52B6728546 for ; Thu, 16 Feb 2017 11:48:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 464B1285B9; Thu, 16 Feb 2017 11:48:11 +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 D488D28546 for ; Thu, 16 Feb 2017 11:48:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754478AbdBPLrb (ORCPT ); Thu, 16 Feb 2017 06:47:31 -0500 Received: from mail-pg0-f66.google.com ([74.125.83.66]:35988 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932096AbdBPLrG (ORCPT ); Thu, 16 Feb 2017 06:47:06 -0500 Received: by mail-pg0-f66.google.com with SMTP id 13so886258pgd.3; Thu, 16 Feb 2017 03:47:05 -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=QSndqqAZqhKbqArU+j+BtVOx90zNxktolQlDDqDJWTc=; b=lxV9cZ8Rfykgv2gUa21/XzCOqfpwPggxSbG+IZiQm0NLGq1ZfT+Ay0KgiDDwM3iesm yL9Rw4kr6c5MFDSrSoo+QDXftAnlzg1DBNWPYEUAxBuqKbF93qD8Ax7hbIIZBMtl9rck sN5KoJC7skG4YrhLepkjQPR/A4enmbEKoDi3HDd5XuI5hKRS1C6qGnxNrerP1rT+tM+9 hPHEfB8CnTZxeuZBPgWiDhklBvXKMrtMaN+5RR2z10yjdcCgg+pAcc6St7J2F3Xdgc4D brLR21DAMaBMqRRKtj4L0Jwt3Q6sH8IF7ab5H3TFZBxdXZpaE+l8FOoo6t93m00FWQZJ EhRA== 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=QSndqqAZqhKbqArU+j+BtVOx90zNxktolQlDDqDJWTc=; b=CKhHlN6Ox9V5WZTEqh+KBMtMm2GMKcFUciyVoPe1h26jRPO3k6qz1Uy7jAQgdPItCF tcnlDHfm/dfMJ6pK/Gl4plFfSTxLaZAMIqVRR2/4sp+7rugVMcPs+XepC+X9Qdfg0tHI 6zKA7A51hGiP1dx5qwdj32ztwHWLXsUXMQ6idrzjiC1SuFOH14mRUIFD4sMOhFdJFfVn YNIr/qeGFGdUNJo6B6+gmMDxmdvIshWzdLcqa2xLR7SWC+Opp/ct1/FNfDl1IZ8s9/2E mUtO6f/z8FaPVzb1JHBxG/Dlo1mLhhfMcIoMLvxqUA8PC0qjCjNM3hukYlNwVDCjNqJ9 ZB4Q== X-Gm-Message-State: AMke39mErCQm46dhol5PBA2Q7sBHmIs1m3ctIQKdhOBRtend5N0fnkipaxoVT9b/sIaJ6w== X-Received: by 10.84.238.199 with SMTP id l7mr2610513pln.90.1487245625257; Thu, 16 Feb 2017 03:47:05 -0800 (PST) Received: from localhost (li405-222.members.linode.com. [106.187.53.222]) by smtp.gmail.com with ESMTPSA id 64sm13255256pfq.112.2017.02.16.03.47.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Feb 2017 03:47:04 -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 17/17] md: raid10: avoid direct access to bvec table in handle_reshape_read_error Date: Thu, 16 Feb 2017 19:45:47 +0800 Message-Id: <1487245547-24384-18-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 | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 5016ce8163c3..d9d7c79a3bd4 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -4689,7 +4689,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; r10b->sector = r10_bio->sector; __raid10_find_phys(&conf->prev, r10b); @@ -4718,7 +4726,7 @@ static int handle_reshape_read_error(struct mddev *mddev, success = sync_page_io(rdev, addr, s << 9, - bvec[idx].bv_page, + pages[idx], REQ_OP_READ, 0, false); rdev_dec_pending(rdev, mddev); rcu_read_lock();