From patchwork Thu Mar 16 16:12:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 9628847 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 AF02B60522 for ; Thu, 16 Mar 2017 16:15:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A098A283F9 for ; Thu, 16 Mar 2017 16:15:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9570628489; Thu, 16 Mar 2017 16:15:01 +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=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 751182840E for ; Thu, 16 Mar 2017 16:15:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755178AbdCPQOz (ORCPT ); Thu, 16 Mar 2017 12:14:55 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:35079 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753959AbdCPQOs (ORCPT ); Thu, 16 Mar 2017 12:14:48 -0400 Received: by mail-pf0-f195.google.com with SMTP id x63so6155589pfx.2; Thu, 16 Mar 2017 09:14:48 -0700 (PDT) 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=4WHfglkceKQmXGaU/QCpugxzbwCGgByaMuMMsy+0M/M=; b=d5Ar3a3TRuE22BOdU+SLY0L+Dib5jQp/tNh+8vGgx/pxcQo/7ma+B8fxn/2Vj4nkL2 is3m/sU300kEO2OGRIuRMiNIX4WYR8ZF+yxjEW+/jwMqxJXETQwmVoINkMZKqT8BcdJ0 KFOPSWjKhV2Y5U08de304/JKsvQQA6+nYCBHDVYBOQw5nF0k/UhnnUU07topzM6QGX6G eea5Zr6Sh6x2H0Kex3WCirIV6qhDuiiYYoaMVTYmhJGjMQ4JqUGvRBE46Az/ycBhqCNJ 2MB0Eg6uZJUFls1y64XsQ23oLYklNf1r+aRi+DbipSAbZRfpO7SE1wqB/Ej+5h9Boh8V 3BDw== 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=4WHfglkceKQmXGaU/QCpugxzbwCGgByaMuMMsy+0M/M=; b=BKi3nV0VE25XuvnjkLcbcQXqt3bti8qXiHuoPz8eMuf/0f1JVGmypoUMV7d/VBRvU4 h20TJQO7FNY40+yqw0ywLdW5mG2oVNJkRAa6Xwyov0aCJ+C/Ao2yPrFlefQ0eP2pEQVa //0qvn3uvN3xg5+UGyOnFQTF16LvqtpXRTG73Ih52PFT2VfhlpXRtli46H4jqJcYV0x+ 0ixAFQ9L7bc9CfGXJ6UE4xw1GK44W3KAmlS2A2gWHkGFTWJP0ZQvf7CFZewKlJaoMsbW lHx7dVRU2Aa7Qw5EtMKd8hR89fWrvaMaxQmQwLh5/LKGX3gLZDffJBV/QU7Z1wquGdMz Hy0w== X-Gm-Message-State: AFeK/H2s9+bO2/WBKjQMEYFBUaAqvR7cjIWKZ1Ad/HQrjxWa10WrcPIjOYWvhHutIdlKaA== X-Received: by 10.98.72.199 with SMTP id q68mr11079434pfi.152.1489680887555; Thu, 16 Mar 2017 09:14:47 -0700 (PDT) Received: from localhost ([103.192.224.52]) by smtp.gmail.com with ESMTPSA id v9sm11478353pfg.133.2017.03.16.09.14.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 16 Mar 2017 09:14:46 -0700 (PDT) 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 v3 13/14] md: raid10: retrieve page from preallocated resync page array Date: Fri, 17 Mar 2017 00:12:34 +0800 Message-Id: <20170316161235.27110-14-tom.leiming@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170316161235.27110-1-tom.leiming@gmail.com> References: <20170316161235.27110-1-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 Now one page array is allocated for each resync bio, and we can retrieve page from this table directly. Signed-off-by: Ming Lei --- drivers/md/raid10.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index d2cb68971486..8db3b0869be4 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -2075,6 +2075,7 @@ static void sync_request_write(struct mddev *mddev, struct r10bio *r10_bio) int i, first; struct bio *tbio, *fbio; int vcnt; + struct page **tpages, **fpages; atomic_set(&r10_bio->remaining, 1); @@ -2090,6 +2091,7 @@ static void sync_request_write(struct mddev *mddev, struct r10bio *r10_bio) fbio = r10_bio->devs[i].bio; fbio->bi_iter.bi_size = r10_bio->sectors << 9; fbio->bi_iter.bi_idx = 0; + fpages = get_resync_pages(fbio)->pages; vcnt = (r10_bio->sectors + (PAGE_SIZE >> 9) - 1) >> (PAGE_SHIFT - 9); /* now find blocks with errors */ @@ -2104,6 +2106,8 @@ static void sync_request_write(struct mddev *mddev, struct r10bio *r10_bio) continue; if (i == first) continue; + + tpages = get_resync_pages(tbio)->pages; d = r10_bio->devs[i].devnum; rdev = conf->mirrors[d].rdev; if (!r10_bio->devs[i].bio->bi_error) { @@ -2116,8 +2120,8 @@ static void sync_request_write(struct mddev *mddev, struct r10bio *r10_bio) int len = PAGE_SIZE; if (sectors < (len / 512)) len = sectors * 512; - if (memcmp(page_address(fbio->bi_io_vec[j].bv_page), - page_address(tbio->bi_io_vec[j].bv_page), + if (memcmp(page_address(fpages[j]), + page_address(tpages[j]), len)) break; sectors -= len/512; @@ -2215,6 +2219,7 @@ 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 page **pages = get_resync_pages(bio)->pages; while (sectors) { int s = sectors; @@ -2230,7 +2235,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; @@ -2238,7 +2243,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);