From patchwork Tue Feb 28 15:41:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 9596067 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 41313601D7 for ; Tue, 28 Feb 2017 15:43:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 323EA28535 for ; Tue, 28 Feb 2017 15:43:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 271192853A; Tue, 28 Feb 2017 15:43:00 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=ham 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 D7BAD28535 for ; Tue, 28 Feb 2017 15:42:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752359AbdB1Pm7 (ORCPT ); Tue, 28 Feb 2017 10:42:59 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:34784 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752530AbdB1Pm5 (ORCPT ); Tue, 28 Feb 2017 10:42:57 -0500 Received: by mail-pg0-f68.google.com with SMTP id s67so1991970pgb.1; Tue, 28 Feb 2017 07:42:51 -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=Mklpo7cF+IdcsnsDupxj5MyjihSzY0cnjSyrB89qjDc=; b=RiQxyjwYeI9ftFmtP9vR9UYdwuPGb4CZmY0O51oBgAmL/HKxPH3x2D7iqQ2ICp6vtp qg4sUzNHedR++movBWj7wzqBWT+/T3fnbB6L6qniyfhpvpimq+40f/9bGK9uNwuP6gd1 XojDQkwa4g6F9i4K+PuDkqE7QiPaWc0aehofjiWcVBFoENlo6HcUKHHWSpmW1otS3UDt BMx5NJHRDcECcSfgwkK/xgXLJMOxFC1QhJOaxN5QKlb1QGUUQjQeMVA4PMJwb1NUxarO ImW1nzcJVH4TRY60pSxUXU8efn1UY+AQ81Ed8qv2tgWcEAQFeOotXvcLNHn6hsT9qFhU qZFw== 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=Mklpo7cF+IdcsnsDupxj5MyjihSzY0cnjSyrB89qjDc=; b=jlXq2to/YIphlmRnDL1obpuY2Z0y9AxA3SWXEAGcc1HtSEQtUMaZbE/bWiSae0JshT 0gBsGiQLTdEpdbTEmJ9Ln4QNPnfYZgTQUbxmLKzOTcdGYtXq+NilFqlcYAJ2S7YZqbai 6tnBzMzRqCs7qAnYmBMQo728VL1JHv6Bs8bdeEMeCodIpxBFq8AlojHxsYrPHOBuViXi DTzpDxhzn9B266rT7HL9w5XT2ovSpJHNs1116psVuTPhsklk/foe6sObs6exsiGIxh85 vxYfwpZnqDG2v5f5FRK3L5veHCROSGS4dwOo3jLeZ1GX2Ci7FpqTa6PIxWLtJ9Se1JbI RZ2w== X-Gm-Message-State: AMke39nvn9qxpQk19s9aw3+6bSrXKFvPvcBbUWH+RZtAvnzmsYISgYlHWTD1q4ZjJCKF3A== X-Received: by 10.99.171.75 with SMTP id k11mr3229191pgp.16.1488296571056; Tue, 28 Feb 2017 07:42:51 -0800 (PST) Received: from localhost ([45.35.47.137]) by smtp.gmail.com with ESMTPSA id q73sm5048096pfa.129.2017.02.28.07.42.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Feb 2017 07:42:50 -0800 (PST) From: Ming Lei To: Shaohua Li , Jens Axboe , linux-raid@vger.kernel.org, linux-block@vger.kernel.org, Christoph Hellwig Cc: Ming Lei Subject: [PATCH v2 13/13] md: raid10: avoid direct access to bvec table in handle_reshape_read_error Date: Tue, 28 Feb 2017 23:41:43 +0800 Message-Id: <1488296503-4987-14-git-send-email-tom.leiming@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488296503-4987-1-git-send-email-tom.leiming@gmail.com> References: <1488296503-4987-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 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; r10b->sector = r10_bio->sector; __raid10_find_phys(&conf->prev, r10b); @@ -4699,7 +4707,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();