Message ID | 20170823171032.30529-3-hch@lst.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Wed, Aug 23, 2017 at 07:10:28PM +0200, Christoph Hellwig wrote: > The block layer always remaps partitions before calling into the > ->make_request methods of drivers. Thus the call to get_start_sect in > in_chunk_boundary will always return 0 and can be removed. > > Signed-off-by: Christoph Hellwig <hch@lst.de> > --- > drivers/md/raid5.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c > index 0fc2748aaf95..d687aeb1b538 100644 > --- a/drivers/md/raid5.c > +++ b/drivers/md/raid5.c > @@ -5092,10 +5092,12 @@ static int raid5_congested(struct mddev *mddev, int bits) > static int in_chunk_boundary(struct mddev *mddev, struct bio *bio) > { > struct r5conf *conf = mddev->private; > - sector_t sector = bio->bi_iter.bi_sector + get_start_sect(bio->bi_bdev); > + sector_t sector = bio->bi_iter.bi_sector; > unsigned int chunk_sectors; > unsigned int bio_sectors = bio_sectors(bio); > > + WARN_ON_ONCE(bio->bi_partno); > + > chunk_sectors = min(conf->chunk_sectors, conf->prev_chunk_sectors); > return chunk_sectors >= > ((sector & (chunk_sectors - 1)) + bio_sectors); Reviewed-by: Shaohua Li <shli@fb.com> -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, Aug 23, 2017 at 11:23:38AM -0700, Shaohua Li wrote: > On Wed, Aug 23, 2017 at 07:10:28PM +0200, Christoph Hellwig wrote: > > The block layer always remaps partitions before calling into the > > ->make_request methods of drivers. Thus the call to get_start_sect in > > in_chunk_boundary will always return 0 and can be removed. > > > > Signed-off-by: Christoph Hellwig <hch@lst.de> > > --- > > drivers/md/raid5.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c > > index 0fc2748aaf95..d687aeb1b538 100644 > > --- a/drivers/md/raid5.c > > +++ b/drivers/md/raid5.c > > @@ -5092,10 +5092,12 @@ static int raid5_congested(struct mddev *mddev, int bits) > > static int in_chunk_boundary(struct mddev *mddev, struct bio *bio) > > { > > struct r5conf *conf = mddev->private; > > - sector_t sector = bio->bi_iter.bi_sector + get_start_sect(bio->bi_bdev); > > + sector_t sector = bio->bi_iter.bi_sector; > > unsigned int chunk_sectors; > > unsigned int bio_sectors = bio_sectors(bio); > > > > + WARN_ON_ONCE(bio->bi_partno); > > + Meh, of course bi_partno is only added a few patches later, so this breaks bisectability. But given that the patch is already in there's probably nothing I can do here. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 0fc2748aaf95..d687aeb1b538 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -5092,10 +5092,12 @@ static int raid5_congested(struct mddev *mddev, int bits) static int in_chunk_boundary(struct mddev *mddev, struct bio *bio) { struct r5conf *conf = mddev->private; - sector_t sector = bio->bi_iter.bi_sector + get_start_sect(bio->bi_bdev); + sector_t sector = bio->bi_iter.bi_sector; unsigned int chunk_sectors; unsigned int bio_sectors = bio_sectors(bio); + WARN_ON_ONCE(bio->bi_partno); + chunk_sectors = min(conf->chunk_sectors, conf->prev_chunk_sectors); return chunk_sectors >= ((sector & (chunk_sectors - 1)) + bio_sectors);
The block layer always remaps partitions before calling into the ->make_request methods of drivers. Thus the call to get_start_sect in in_chunk_boundary will always return 0 and can be removed. Signed-off-by: Christoph Hellwig <hch@lst.de> --- drivers/md/raid5.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)