From patchwork Fri Feb 24 15:42: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: 9590613 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 8A5616020A for ; Fri, 24 Feb 2017 15:48:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B33622BF1 for ; Fri, 24 Feb 2017 15:48:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 70252286CC; Fri, 24 Feb 2017 15:48:46 +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 240CE22BF1 for ; Fri, 24 Feb 2017 15:48:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751531AbdBXPoL (ORCPT ); Fri, 24 Feb 2017 10:44:11 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:36323 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751386AbdBXPnk (ORCPT ); Fri, 24 Feb 2017 10:43:40 -0500 Received: by mail-pf0-f193.google.com with SMTP id c193so1166724pfb.3; Fri, 24 Feb 2017 07:43:39 -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=vZ33w0OMegWU7ifJK7kIdHbaLq+GvQObdX0qRErSkuw=; b=ACwOJSFo1A9thNGa1A8A8GgydF5SvoayR4T3KG7UZF5oAmKoB1Dsi6pZ2zAkrrnGl2 8ayFuTUshw4BIPBz4UptKZkz2+BzNoTHWmJaq6tcDVdMC6fyO+wQD7hQM8u/4yG6NBA+ wX1WV8S35D+qXvzfehBF96hgUxESzZBgiicIkVFD4sMobJ2s0so3qCxmG9rxyB3DXaO/ i+2QdsA1YRFVLJ03Q5yg+qKUJ3KGD6UljUEvs9rZgEaBW6tj0Qj83QcMRjnaxCs4bufk m4Z1ftsXHH5aSsrcNWVkGVRYuVYwHdfUkWscMxquE2VH5w49wymNVgYLpHRVtSJoEiaz hshw== 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=vZ33w0OMegWU7ifJK7kIdHbaLq+GvQObdX0qRErSkuw=; b=BSBhePtf4p7Yak3FlDNg9vzp2rD8dW28n2iitlPBS+uKMP2HoMvo/wtPJt8Kfr776e uR8ZEICw6HQ0Il7J6DgB9hONjgPe21UGNLXkrK2w7XFhgTyyxXh+xAkjFvplg07b3VBR oK+BEZGW+osax+XGvA0ds4wN07UBre2ZU5/8h4C3r3ZZ9G6W7G/lLlqLmbX71oprQq1y QnkaPUuYNsWW/ag8gRlyZQFayQbr2X1Sx7TcCHcZRuR8LNolERYxhXFJk7Xa4x25dmzd oYPyX1B/QCUthpOq9O/1KfEYjtwyxmldZt2FHaBnrOzhoj6PTCR04U3uc0v2DjQiksh4 dd4A== X-Gm-Message-State: AMke39kgF7WRicCcV7jQq2yeosQHxMeeRB4PH5gptqSAwv/Bc2h/6LZLhvNu3g0w8xmQNg== X-Received: by 10.84.214.9 with SMTP id h9mr4615443pli.65.1487951019508; Fri, 24 Feb 2017 07:43:39 -0800 (PST) Received: from localhost (li405-222.members.linode.com. [106.187.53.222]) by smtp.gmail.com with ESMTPSA id l22sm15936771pgc.35.2017.02.24.07.43.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Feb 2017 07:43:38 -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 08/14] md: raid1: retrieve page from pre-allocated resync page array Date: Fri, 24 Feb 2017 23:42:45 +0800 Message-Id: <1487950971-1131-9-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 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/raid1.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 4a208220ff0f..9371caace379 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -1970,6 +1970,7 @@ static int fix_sync_read_error(struct r1bio *r1_bio) struct mddev *mddev = r1_bio->mddev; struct r1conf *conf = mddev->private; struct bio *bio = r1_bio->bios[r1_bio->read_disk]; + struct page **pages = get_resync_pages(bio)->pages; sector_t sect = r1_bio->sector; int sectors = r1_bio->sectors; int idx = 0; @@ -2003,7 +2004,7 @@ static int fix_sync_read_error(struct r1bio *r1_bio) */ rdev = conf->mirrors[d].rdev; if (sync_page_io(rdev, sect, s<<9, - bio->bi_io_vec[idx].bv_page, + pages[idx], REQ_OP_READ, 0, false)) { success = 1; break; @@ -2058,7 +2059,7 @@ static int fix_sync_read_error(struct r1bio *r1_bio) continue; rdev = conf->mirrors[d].rdev; if (r1_sync_page_io(rdev, sect, s, - bio->bi_io_vec[idx].bv_page, + pages[idx], WRITE) == 0) { r1_bio->bios[d]->bi_end_io = NULL; rdev_dec_pending(rdev, mddev); @@ -2073,7 +2074,7 @@ static int fix_sync_read_error(struct r1bio *r1_bio) continue; rdev = conf->mirrors[d].rdev; if (r1_sync_page_io(rdev, sect, s, - bio->bi_io_vec[idx].bv_page, + pages[idx], READ) != 0) atomic_add(s, &rdev->corrected_errors); } @@ -2149,6 +2150,8 @@ static void process_checks(struct r1bio *r1_bio) struct bio *pbio = r1_bio->bios[primary]; struct bio *sbio = r1_bio->bios[i]; int error = sbio->bi_error; + struct page **ppages = get_resync_pages(pbio)->pages; + struct page **spages = get_resync_pages(sbio)->pages; if (sbio->bi_end_io != end_sync_read) continue; @@ -2157,11 +2160,8 @@ static void process_checks(struct r1bio *r1_bio) if (!error) { for (j = vcnt; j-- ; ) { - struct page *p, *s; - p = pbio->bi_io_vec[j].bv_page; - s = sbio->bi_io_vec[j].bv_page; - if (memcmp(page_address(p), - page_address(s), + if (memcmp(page_address(ppages[j]), + page_address(spages[j]), sbio->bi_io_vec[j].bv_len)) break; }