From patchwork Thu Feb 16 11:45:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 9576931 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 6FD4460586 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 703D428546 for ; Thu, 16 Feb 2017 11:48:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6521B285B7; 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 019FA2855B for ; Thu, 16 Feb 2017 11:48:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754759AbdBPLrG (ORCPT ); Thu, 16 Feb 2017 06:47:06 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:34487 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932246AbdBPLrE (ORCPT ); Thu, 16 Feb 2017 06:47:04 -0500 Received: by mail-pg0-f68.google.com with SMTP id v184so1828936pgv.1; Thu, 16 Feb 2017 03:47: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=eKLY3xQO3VcEV6cFp42+wk7yekN5KSRijmteLUgalmU=; b=b/nqMRkmPkzFDbnfsKKy0jTfxMOUQ2gNdbtlw9l8CSzGFV9wAJ1s/9xbiN+08+L/7l G/402FQiSnMOtW44wRq2b7fdWlAu57B+K+PjcBd4+JjcAon+uiXTqpQKUIiRZXvRLdPc GctVUiMy1WMWu5APkbA7fEOY8/3j6w/TWF+sJKj1jXHko4Cg2tj9an0HH1kA0t9iXLhx /yuDUm4St5CzOa3+7BnJCUPBeRWCMZLsnoA4NU89btjdjdC5sluUdyuTk1h6HfAJtAQx hJ0HM34NF04UxlQswrFmMhLdzQEXMzS/CRxeIBUf/RNKRRe2bjVW5KSCiE3jK0kqvMD9 QY1g== 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=eKLY3xQO3VcEV6cFp42+wk7yekN5KSRijmteLUgalmU=; b=LYiYtN+2ciiWZOoS7vyhmsm51WIoLzBvVYNR2i8L2ySbkWMpr9DFR8Hlu+dOT5S50+ wvlPEoRh+8xFB8UKCZFnsAjgNrTV75Fen1x/xg6ql7XLj9jB0QbW5wlY/fitpseuUk3f FIjtULALk0detMAtQlAZTDZbSROwBuOP4TSQGWHTtsSX3v8XsarZNzqR/G49XpLutwj1 S8euloif+ieW+vC7Dvaq+KjfRYqa/fwQvCLKCBUxSOUEKPZimNSoG/Ftc1Jlgy7gZ39Q ZAl9RXtHF+nEtGccvXNeMcq6kgCyP6dujxiZihtEJD+wZUlPBNJcTG6964P76UCMQNWX qFYw== X-Gm-Message-State: AMke39n9OE1cKJdNTKGVHJTSxFspfiRYwcG9YCEQVHckAPx8LJ760GZmpgLNpLIXjtssjw== X-Received: by 10.84.245.1 with SMTP id i1mr2581387pll.131.1487245618437; Thu, 16 Feb 2017 03:46:58 -0800 (PST) Received: from localhost (li405-222.members.linode.com. [106.187.53.222]) by smtp.gmail.com with ESMTPSA id b67sm13282089pfj.81.2017.02.16.03.46.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Feb 2017 03:46:57 -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 15/17] md: raid10: avoid direct access to bvec table in fix_recovery_read_error Date: Thu, 16 Feb 2017 19:45:45 +0800 Message-Id: <1487245547-24384-16-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 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 69fe2a3cef89..c7d2f73565d9 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -2184,6 +2184,11 @@ static void fix_recovery_read_error(struct r10bio *r10_bio) int idx = 0; int dr = r10_bio->devs[0].devnum; int dw = r10_bio->devs[1].devnum; + struct bio_vec *bvl; + struct page *pages[RESYNC_PAGES]; + + bio_for_each_segment_all(bvl, bio, idx) + pages[idx] = bvl->bv_page; while (sectors) { int s = sectors; @@ -2199,7 +2204,7 @@ static void fix_recovery_read_error(struct r10bio *r10_bio) ok = sync_page_io(rdev, addr, s << 9, - bio->bi_io_vec[idx].bv_page, + pages[idx], REQ_OP_READ, 0, false); if (ok) { rdev = conf->mirrors[dw].rdev; @@ -2207,7 +2212,7 @@ static void fix_recovery_read_error(struct r10bio *r10_bio) ok = sync_page_io(rdev, addr, s << 9, - bio->bi_io_vec[idx].bv_page, + pages[idx], REQ_OP_WRITE, 0, false); if (!ok) { set_bit(WriteErrorSeen, &rdev->flags);