[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150506072637.GB23083@lst.de>
Date: Wed, 6 May 2015 09:26:37 +0200
From: Christoph Hellwig <hch@....de>
To: Ming Lin <mlin@...nel.org>
Cc: NeilBrown <neilb@...e.de>, linux-kernel@...r.kernel.org,
Christoph Hellwig <hch@....de>, Jens Axboe <axboe@...nel.dk>,
Kent Overstreet <kent.overstreet@...il.com>,
Dongsu Park <dongsu.park@...fitbricks.com>,
Lars Ellenberg <drbd-dev@...ts.linbit.com>,
drbd-user@...ts.linbit.com, Jiri Kosina <jkosina@...e.cz>,
Yehuda Sadeh <yehuda@...tank.com>,
Sage Weil <sage@...tank.com>, Alex Elder <elder@...nel.org>,
ceph-devel@...r.kernel.org, Alasdair Kergon <agk@...hat.com>,
Mike Snitzer <snitzer@...hat.com>, dm-devel@...hat.com,
linux-raid@...r.kernel.org, Christoph Hellwig <hch@...radead.org>,
"Martin K. Petersen" <martin.petersen@...cle.com>
Subject: Re: [PATCH 07/10] block: kill merge_bvec_fn() completely
> -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;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists