Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752869AbbEFRFS (ORCPT ); Wed, 6 May 2015 13:05:18 -0400 Received: from mail.kernel.org ([198.145.29.136]:47814 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751599AbbEFRFN (ORCPT ); Wed, 6 May 2015 13:05:13 -0400 MIME-Version: 1.0 In-Reply-To: <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> <20150506072637.GB23083@lst.de> Date: Wed, 6 May 2015 10:05:09 -0700 Message-ID: Subject: Re: [PATCH 07/10] block: kill merge_bvec_fn() completely From: Ming Lin To: Christoph Hellwig Cc: Ming Lin , NeilBrown , lkml , Jens Axboe , Kent Overstreet , Dongsu Park , Lars Ellenberg , drbd-user@lists.linbit.com, Jiri Kosina , Yehuda Sadeh , Sage Weil , Alex Elder , ceph-devel@vger.kernel.org, Alasdair Kergon , Mike Snitzer , dm-devel@redhat.com, linux-raid@vger.kernel.org, Christoph Hellwig , "Martin K. Petersen" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2005 Lines: 52 On Wed, May 6, 2015 at 12:26 AM, Christoph Hellwig wrote: >> -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; > } Will update all. Thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/