From patchwork Mon May 4 07:47:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lin X-Patchwork-Id: 6323591 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D2B779F1C2 for ; Mon, 4 May 2015 07:52:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0B9E8202C8 for ; Mon, 4 May 2015 07:52:41 +0000 (UTC) Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0B665202BE for ; Mon, 4 May 2015 07:52:39 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id t447lkAP015037; Mon, 4 May 2015 03:47:48 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id t447lieB018820 for ; Mon, 4 May 2015 03:47:44 -0400 Received: from mx1.redhat.com (ext-mx04.extmail.prod.ext.phx2.redhat.com [10.5.110.28]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t447lhCW005334 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 4 May 2015 03:47:43 -0400 Received: from mail-pd0-f169.google.com (mail-pd0-f169.google.com [209.85.192.169]) by mx1.redhat.com (Postfix) with ESMTPS id F0F3A8F2F2; Mon, 4 May 2015 07:47:42 +0000 (UTC) Received: by pdbnk13 with SMTP id nk13so156350836pdb.0; Mon, 04 May 2015 00:47:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=+REpguN36Wrwa5mPGpWcrFGK8hqEhUGdTwSsIjELAbk=; b=exWhwAKvmjHCguDZMQuNxjVba7zy8JFAh5F4ScOeAbH/D2AKVSuXxueIKe8B9H5kGF nbqf2084mTXUtftiAmcE/0Lo5sVmNhGjuqRYO0CXUTOs8zjjrfZRjy7Zdv55x29Gc/co uJtKhMgfZyor976oNigRyVJYM+75BnG/33VJHnA+HFEdPfi6yuJyw26sneZqdx+Qy9hh md2goqds+VJ3MlgW30KRjkE7aW4ZGijfZT1NGCI05IxPGqEN2GEdihalHhMf/ZuWVrp5 IjWK/8HDxSXKbm6KKJGCteZf4u5YPDWlGPCAQuA7qav2T4ZM1UlaPb0emOhX3uIH3LfJ CVWg== X-Received: by 10.66.142.76 with SMTP id ru12mr36233669pab.142.1430725662259; Mon, 04 May 2015 00:47:42 -0700 (PDT) Received: from ?IPv6:2601:9:4f80:1b7:8994:cf81:165a:6413? ([2601:9:4f80:1b7:8994:cf81:165a:6413]) by mx.google.com with ESMTPSA id kh6sm11867021pbc.50.2015.05.04.00.47.40 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 May 2015 00:47:41 -0700 (PDT) Message-ID: <5547241B.1040903@kernel.org> Date: Mon, 04 May 2015 00:47:39 -0700 From: Ming Lin User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: NeilBrown References: <1430203717-13307-1-git-send-email-mlin@kernel.org> <1430203717-13307-8-git-send-email-mlin@kernel.org> <20150429080919.342fddfd@notabene.brown> In-Reply-To: <20150429080919.342fddfd@notabene.brown> X-RedHat-Spam-Score: -2.451 (BAYES_00, DCC_REPUT_13_19, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_PASS) 209.85.192.169 mail-pd0-f169.google.com 209.85.192.169 mail-pd0-f169.google.com X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Scanned-By: MIMEDefang 2.75 on 10.5.110.28 X-loop: dm-devel@redhat.com Cc: Jens Axboe , Christoph Hellwig , Alex Elder , Sage Weil , Mike Snitzer , Jiri Kosina , linux-kernel@vger.kernel.org, Yehuda Sadeh , Dongsu Park , linux-raid@vger.kernel.org, dm-devel@redhat.com, Alasdair Kergon , "Martin K. Petersen" , ceph-devel@vger.kernel.org, Christoph Hellwig , Kent Overstreet , drbd-user@lists.linbit.com, Lars Ellenberg Subject: Re: [dm-devel] [PATCH 07/10] block: kill merge_bvec_fn() completely X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 04/28/2015 03:09 PM, NeilBrown wrote: > On Mon, 27 Apr 2015 23:48:34 -0700 Ming Lin wrote: > >> From: Kent Overstreet >> >> As generic_make_request() is now able to handle arbitrarily sized bios, >> it's no longer necessary for each individual block driver to define its >> own ->merge_bvec_fn() callback. Remove every invocation completely. > > This patch it just a little premature I think. > > md/raid5 still assumes read requests will mostly fit within a single chunk > (which merge_bvec_fn encourages) so they can be serviced without using the > stripe-cache. > You've just broken that assumption. > > I think 'chunk_aligned_read' needs to get a loop using bio_split, a bit like > raid0, first. How about below? drivers/md/raid5.c | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) --- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index e42b624..2ddfa1e 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -4709,7 +4709,7 @@ static void raid5_align_endio(struct bio *bi, int error) add_bio_to_retry(raid_bi, conf); } -static int chunk_aligned_read(struct mddev *mddev, struct bio * raid_bio) +static int __chunk_aligned_read(struct mddev *mddev, struct bio *raid_bio) { struct r5conf *conf = mddev->private; int dd_idx; @@ -4718,7 +4718,7 @@ static int chunk_aligned_read(struct mddev *mddev, struct bio * raid_bio) sector_t end_sector; if (!in_chunk_boundary(mddev, raid_bio)) { - pr_debug("chunk_aligned_read : non aligned\n"); + pr_debug("__chunk_aligned_read : non aligned\n"); return 0; } /* @@ -4793,6 +4793,35 @@ static int chunk_aligned_read(struct mddev *mddev, struct bio * raid_bio) } } +static struct bio *chunk_aligned_read(struct mddev *mddev, struct bio *raid_bio) +{ + struct bio *split; + + do { + sector_t sector = raid_bio->bi_iter.bi_sector; + unsigned chunk_sects = mddev->chunk_sectors; + + unsigned sectors = chunk_sects - + (likely(is_power_of_2(chunk_sects)) + ? (sector & (chunk_sects-1)) + : sector_div(sector, chunk_sects)); + + if (sectors < bio_sectors(raid_bio)) { + split = bio_split(raid_bio, sectors, GFP_NOIO, fs_bio_set); + bio_chain(split, raid_bio); + } else + split = raid_bio; + + if (!__chunk_aligned_read(mddev, split)) { + if (split != raid_bio) + generic_make_request(raid_bio); + return split; + } + } while (split != raid_bio); + + return NULL; +} + /* __get_priority_stripe - get the next stripe to process * * Full stripe writes are allowed to pass preread active stripes up until @@ -5071,7 +5100,7 @@ static void make_request(struct mddev *mddev, struct bio * bi) */ if (rw == READ && mddev->degraded == 0 && mddev->reshape_position == MaxSector && - chunk_aligned_read(mddev,bi)) + (!(bi = chunk_aligned_read(mddev, bi)))) return; if (unlikely(bi->bi_rw & REQ_DISCARD)) {