From patchwork Tue Feb 28 15:41:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 9596051 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 ABC98601D7 for ; Tue, 28 Feb 2017 15:42:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9CEE628535 for ; Tue, 28 Feb 2017 15:42:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 91B962853A; Tue, 28 Feb 2017 15:42:33 +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 4456528535 for ; Tue, 28 Feb 2017 15:42:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752426AbdB1Pmb (ORCPT ); Tue, 28 Feb 2017 10:42:31 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:34906 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752366AbdB1Pma (ORCPT ); Tue, 28 Feb 2017 10:42:30 -0500 Received: by mail-pf0-f195.google.com with SMTP id y23so1487178pfk.2; Tue, 28 Feb 2017 07:42:29 -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=zAULVU0bkNSRy09wmPufEfeBd5qZGGr4rWipz+df290=; b=nXeV/CG7ERJiM/aC5Oe2w+q+ltA46FMCtTvHmMpQvwqvfGKFZGXBfLwokB0rHTm8Iw VIP/7lHKsbvFtMiJ45WnVfC2fNDYHoDr6qpcSd7Jnt/O4BOKYFAwuDY1d6ya4AgJXQM4 IDBrEHi66d/b/QkOckPg4UJ+4K+PDhnM08+2bKph3HcuZCzbcHtitl0Sjsz22CYRiV7U cpFiFocR8BZOMseKaz3PDhUtYdAj2Wd2IMukNnZRH3y8nlKLCKNmBI1hLQqSrfmcw02B 6E5SbGIHjNM8EU9zZ3RruyL4nUogmB9gLbnXKuqRebobFNjdB/p4ZTaXgZx2zcLM19fW gtoQ== 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=zAULVU0bkNSRy09wmPufEfeBd5qZGGr4rWipz+df290=; b=BD4m5oVf6Ka8czJ/VlcDsCX8JIT/PquWPcygHdAGvvowp48rwuFohry7yZ87xV6iuc CXo0kLuu68d577Zb6GUvh4UEG34+T5iA2Sc8kZ4YuVqxWQyEF4Ieij8HG/Bsfl2bDToi vuwSlYaNWccKK6VSo+rI3Yyf1xJBfN4JNEKuIuBjKA8IN5HR5RPHpIFijSsT/vnsvhtw 4dNCmliCNww2AGRpHtF93+Y5uWv1rqkYUcf2vlObh830079u1kcC5dqQ4WJRWiLP+vgj QwGW982fhK+vtYZzBQi1HLD26m/MErMhon3ZLCb8AuvDLPmF2K/RdtTpOjKigfqe6nU+ 34jg== X-Gm-Message-State: AMke39lxspgbkvHb7ZBKFJHF/vzqP7/hAdFS++UKJUn5Jjjc1lWarYPt26ux9MARQXGU0A== X-Received: by 10.84.193.101 with SMTP id e92mr3883869pld.4.1488296549238; Tue, 28 Feb 2017 07:42:29 -0800 (PST) Received: from localhost ([45.35.47.137]) by smtp.gmail.com with ESMTPSA id z27sm5074585pfg.38.2017.02.28.07.42.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Feb 2017 07:42:28 -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 07/13] md: raid1: retrieve page from pre-allocated resync page array Date: Tue, 28 Feb 2017 23:41:37 +0800 Message-Id: <1488296503-4987-8-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/raid1.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 900144f39630..d0cb5c026506 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; }