Skip to content

Commit ac06773

Browse files
committed
btrfs: merge calculations for simple striped profiles in btrfs_rmap_block
Use the same expression for stripe_nr for RAID0 (map->sub_stripes is 1) and RAID10 (map->sub_stripes is 2), with equivalent results. Reviewed-by: Nikolay Borisov <[email protected]> Reviewed-by: Johannes Thumshirn <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent d09cb9e commit ac06773

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

fs/btrfs/block-group.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1816,11 +1816,10 @@ int btrfs_rmap_block(struct btrfs_fs_info *fs_info, u64 chunk_start,
18161816
stripe_nr = physical - map->stripes[i].physical;
18171817
stripe_nr = div64_u64_rem(stripe_nr, map->stripe_len, &offset);
18181818

1819-
if (map->type & BTRFS_BLOCK_GROUP_RAID10) {
1819+
if (map->type & (BTRFS_BLOCK_GROUP_RAID0 |
1820+
BTRFS_BLOCK_GROUP_RAID10)) {
18201821
stripe_nr = stripe_nr * map->num_stripes + i;
18211822
stripe_nr = div_u64(stripe_nr, map->sub_stripes);
1822-
} else if (map->type & BTRFS_BLOCK_GROUP_RAID0) {
1823-
stripe_nr = stripe_nr * map->num_stripes + i;
18241823
}
18251824
/*
18261825
* The remaining case would be for RAID56, multiply by

0 commit comments

Comments
 (0)