From patchwork Tue Feb 28 15:41:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 9596063 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 A4BDF601D7 for ; Tue, 28 Feb 2017 15:42:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 95CE828538 for ; Tue, 28 Feb 2017 15:42:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8AF162853A; Tue, 28 Feb 2017 15:42:57 +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 1D96028535 for ; Tue, 28 Feb 2017 15:42:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752546AbdB1Pmz (ORCPT ); Tue, 28 Feb 2017 10:42:55 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:36605 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752366AbdB1Pmw (ORCPT ); Tue, 28 Feb 2017 10:42:52 -0500 Received: by mail-pg0-f65.google.com with SMTP id 25so1985438pgy.3; 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=RsOGYkGkze2nLxdZKP0RTMDjOve2w6WHrDKp62o9kGY=; b=DLgapdy3dlheO0AzrkuXitzdheo+EjnVsELVz5TEcIIRSsMKdIvKRr1zyZ/TErLild bfrhWIxFMGR0U4LKBwQsnejyemXZHalITqOUM5fk3j0191eTncWkWH7iYwyRPYb10Fdx PdzPcreXrFG0Z4/nJDWHuM5PvSUcAUTZeKtkaja5BFBSKK86cj2Civ8oCJ3QPO6Ah58r MQFxc0OA7Ly3+zJHEcObD1gSp4ccP9CQuhmPbF2ggP6VNFOLFg3I7Mp55A/0fIIsX3Gp tg4eZ0WypzFMwymTe1BFQjIpfRnqY6BEvoZIZqLEcZ0K03ZyLY4oiMq4MFyET6brTutq 6BsQ== 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=RsOGYkGkze2nLxdZKP0RTMDjOve2w6WHrDKp62o9kGY=; b=HapNfeNqDvJQjHFA+iQIfns590RRx53g5zOsdflTLCL5Qb06wz/RBVfGNrP6uzwB6F I4rKTLXWUBdfB/pAC4vEa8VvoLsiH/gQhSD+/ILC+NFP8CGZvsEeuobqGx1bvVtzThSM OBYj956g1e06bwDB61TW8WwG2Ilf1Gir/nyRoFgKMTvezJWp4PqrbswPxYh3sAM/8ZQb VbZLAcvXPkT1zrGh4WHcv6eOnVKhTYjHzBAcjMGezXIjWjxzC8yRvdueD1F54TENxOv1 6f+IoTg9Vg9RZHCt/BqASsPAy7j/vG8C3Zc+RkAI3dm+JQhwfCG3ruOCj0OXq79pYj/v YUqQ== X-Gm-Message-State: AMke39kLuTtQ4XqD2TAnLEL883wq7VR0vYSbMTc6NG9WuK3mFIWhrA9GlP3I7z2AGCrFeA== X-Received: by 10.99.66.3 with SMTP id p3mr3253709pga.214.1488296566234; Tue, 28 Feb 2017 07:42:46 -0800 (PST) Received: from localhost ([45.35.47.137]) by smtp.gmail.com with ESMTPSA id n8sm5109575pgc.16.2017.02.28.07.42.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Feb 2017 07:42:45 -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 12/13] md: raid10: retrieve page from preallocated resync page array Date: Tue, 28 Feb 2017 23:41:42 +0800 Message-Id: <1488296503-4987-13-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 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 f887b21332e7..0b97631e3905 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -2065,6 +2065,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); @@ -2080,6 +2081,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 */ @@ -2094,6 +2096,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) { @@ -2106,8 +2110,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; @@ -2205,6 +2209,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; @@ -2220,7 +2225,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; @@ -2228,7 +2233,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);