From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from zimbra13.linbit.com (zimbra.linbit.com [212.69.161.123]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by mail09.linbit.com (LINBIT Mail Daemon) with ESMTPS id 6EBA910556DB for ; Thu, 7 May 2015 11:35:44 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra13.linbit.com (Postfix) with ESMTP id 69A4E449119 for ; Thu, 7 May 2015 11:35:44 +0200 (CEST) Received: from zimbra13.linbit.com ([127.0.0.1]) by localhost (zimbra13.linbit.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 2XbDGe6WIRKi for ; Thu, 7 May 2015 11:35:44 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra13.linbit.com (Postfix) with ESMTP id 4EA5844A5E5 for ; Thu, 7 May 2015 11:35:44 +0200 (CEST) Received: from zimbra13.linbit.com ([127.0.0.1]) by localhost (zimbra13.linbit.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id VZuHbuYyDpzV for ; Thu, 7 May 2015 11:35:44 +0200 (CEST) Received: from soda.linbit (tuerlsteher.linbit.com [86.59.100.100]) by zimbra13.linbit.com (Postfix) with ESMTPS id 27E58449119 for ; Thu, 7 May 2015 11:35:44 +0200 (CEST) Resent-Message-ID: <20150507093543.GY18767@soda.linbit> Date: Wed, 6 May 2015 09:26:37 +0200 From: Christoph Hellwig To: Ming Lin Message-ID: <20150506072637.GB23083@lst.de> References: <1430203717-13307-1-git-send-email-mlin@kernel.org> <1430203717-13307-8-git-send-email-mlin@kernel.org> <20150429080919.342fddfd@notabene.brown> <5547241B.1040903@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5547241B.1040903@kernel.org> Cc: Jens Axboe , Christoph Hellwig , Alex Elder , Sage Weil , Mike Snitzer , NeilBrown , Jiri Kosina , linux-kernel@vger.kernel.org, Yehuda Sadeh , 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: [Drbd-dev] [PATCH 07/10] block: kill merge_bvec_fn() completely List-Id: "*Coordination* of development, patches, contributions -- *Questions* \(even to developers\) go to drbd-user, please." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , > -static int chunk_aligned_read(struct mddev *mddev, struct bio * raid_bio) > +static int __chunk_aligned_read(struct mddev *mddev, struct bio *raid_bio) Call it raid5_read_one_chunk or something similar descriptive? > { > 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"); Switch to __func__? > +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)); This would be a lot more readable with a good old if. > if (rw == READ && mddev->degraded == 0 && > mddev->reshape_position == MaxSector && > - chunk_aligned_read(mddev,bi)) > + (!(bi = chunk_aligned_read(mddev, bi)))) > return; if (rw == READ && mddev->degraded == 0 && mddev->reshape_position == MaxSector) { bi = chunk_aligned_read(mddev, bi); if (!bi) return; }