Commit d6e412ea authored by NeilBrown's avatar NeilBrown

md: raid0: chunk_sectors cleanups.

following the conversion to chunk_sectors, there is room
for cleaning up a little.
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
parent cdc2ae6d
...@@ -273,7 +273,7 @@ static int raid0_mergeable_bvec(struct request_queue *q, ...@@ -273,7 +273,7 @@ static int raid0_mergeable_bvec(struct request_queue *q,
unsigned int chunk_sectors = mddev->chunk_sectors; unsigned int chunk_sectors = mddev->chunk_sectors;
unsigned int bio_sectors = bvm->bi_size >> 9; unsigned int bio_sectors = bvm->bi_size >> 9;
if (is_power_of_2(mddev->chunk_sectors)) if (is_power_of_2(chunk_sectors))
max = (chunk_sectors - ((sector & (chunk_sectors-1)) max = (chunk_sectors - ((sector & (chunk_sectors-1))
+ bio_sectors)) << 9; + bio_sectors)) << 9;
else else
...@@ -384,7 +384,7 @@ static mdk_rdev_t *map_sector(mddev_t *mddev, struct strip_zone *zone, ...@@ -384,7 +384,7 @@ static mdk_rdev_t *map_sector(mddev_t *mddev, struct strip_zone *zone,
raid0_conf_t *conf = mddev->private; raid0_conf_t *conf = mddev->private;
unsigned int chunk_sects = mddev->chunk_sectors; unsigned int chunk_sects = mddev->chunk_sectors;
if (is_power_of_2(mddev->chunk_sectors)) { if (is_power_of_2(chunk_sects)) {
int chunksect_bits = ffz(~chunk_sects); int chunksect_bits = ffz(~chunk_sects);
/* find the sector offset inside the chunk */ /* find the sector offset inside the chunk */
sect_in_chunk = sector & (chunk_sects - 1); sect_in_chunk = sector & (chunk_sects - 1);
...@@ -414,7 +414,7 @@ static mdk_rdev_t *map_sector(mddev_t *mddev, struct strip_zone *zone, ...@@ -414,7 +414,7 @@ static mdk_rdev_t *map_sector(mddev_t *mddev, struct strip_zone *zone,
static inline int is_io_in_chunk_boundary(mddev_t *mddev, static inline int is_io_in_chunk_boundary(mddev_t *mddev,
unsigned int chunk_sects, struct bio *bio) unsigned int chunk_sects, struct bio *bio)
{ {
if (likely(is_power_of_2(mddev->chunk_sectors))) { if (likely(is_power_of_2(chunk_sects))) {
return chunk_sects >= ((bio->bi_sector & (chunk_sects-1)) return chunk_sects >= ((bio->bi_sector & (chunk_sects-1))
+ (bio->bi_size >> 9)); + (bio->bi_size >> 9));
} else{ } else{
...@@ -456,7 +456,7 @@ static int raid0_make_request(struct request_queue *q, struct bio *bio) ...@@ -456,7 +456,7 @@ static int raid0_make_request(struct request_queue *q, struct bio *bio)
/* This is a one page bio that upper layers /* This is a one page bio that upper layers
* refuse to split for us, so we need to split it. * refuse to split for us, so we need to split it.
*/ */
if (likely(is_power_of_2(mddev->chunk_sectors))) if (likely(is_power_of_2(chunk_sects)))
bp = bio_split(bio, chunk_sects - (sector & bp = bio_split(bio, chunk_sects - (sector &
(chunk_sects-1))); (chunk_sects-1)));
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment