From patchwork Fri Feb 24 15:42:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 9590639 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 1A48160578 for ; Fri, 24 Feb 2017 15:49:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1014222BF1 for ; Fri, 24 Feb 2017 15:49:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EDBB3287B3; Fri, 24 Feb 2017 15:49:40 +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 B293628687 for ; Fri, 24 Feb 2017 15:49:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751403AbdBXPoG (ORCPT ); Fri, 24 Feb 2017 10:44:06 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:34977 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751327AbdBXPoD (ORCPT ); Fri, 24 Feb 2017 10:44:03 -0500 Received: by mail-pg0-f67.google.com with SMTP id 1so3452933pgz.2; Fri, 24 Feb 2017 07:44:03 -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=Vz2j2jfAjxbQg31ofzwh0VR6fxeRph2IWJa9DZNxOtY=; b=uZaFzC3uP7k4Ox3SzoyM+FeRRQsX3B8ihtqj3IwDvCHzfE0yN+P9W1Sp6zjtOaXJJH oaHnPfryMShO6DozB41M3YW4JbEUER+n4epRRVQKke08PRNSVdxzhC/CUTVpWsEm0aUq Bg33qrqdifmdOqpDhg4LK1O9nQfwxva1K2eBnzca4kJ7QIxzRCeJG1DNlCozMUDs963p RtxvhJIE0K8GO7q5Np7uP/U8REAhOTX6WptPXDrc6j5BnBHnKXs8151QawRGn5BPOcoe iB3w6W3agcyEVk4uWuX0AwXWFv0sozU3JIfseg2J8kRGEBz7MaZFIYvhlhlDZU2MER0V 870w== 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=Vz2j2jfAjxbQg31ofzwh0VR6fxeRph2IWJa9DZNxOtY=; b=cRxJJt3azg3U1Ud4Iey13pBPM98gQieqG8VAgB//1Jf1PZrDO7M/80TV5jc+c+RQZ+ Gj/mMaA0SWGheaY1lmr0GleJ+gyhZK5WWcRcQW4BE7keDgaBgyn21pFkarMrZHUB+2nn B+b5sogmgrUgU3btnW3ytImurFjNSrz+ZRoJ8Ay2opJytmJTdsePeFCl3Pw6aKYkWlTt 2WNA0mR6hkLHl5bqfs3IRJaa+pulgkazD8bPYfbXyV+cTvTOMnFVy5wTVm0E9HshJeMQ gBHH96M+Q2LHEgbIEbUpN6bbC+SCjSpPfUxs6gT60QaTEwLQj1YDTYWDLpGwrRdhy2Zr xBSg== X-Gm-Message-State: AMke39koxl4ugBvHzNxQt9vT29lQYFeg4/ibuJzyt8RveVhx+e5Twkdwjq3nGHY9Y9BP/w== X-Received: by 10.98.158.219 with SMTP id f88mr4300619pfk.50.1487951042980; Fri, 24 Feb 2017 07:44:02 -0800 (PST) Received: from localhost (li405-222.members.linode.com. [106.187.53.222]) by smtp.gmail.com with ESMTPSA id x2sm15840512pfa.71.2017.02.24.07.44.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Feb 2017 07:44:02 -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 Cc: Ming Lei Subject: [PATCH v1 14/14] md: raid10: avoid direct access to bvec table in handle_reshape_read_error Date: Fri, 24 Feb 2017 23:42:51 +0800 Message-Id: <1487950971-1131-15-git-send-email-tom.leiming@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487950971-1131-1-git-send-email-tom.leiming@gmail.com> References: <1487950971-1131-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 ae162d542bf4..705cb9af03ef 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();