summaryrefslogtreecommitdiff
path: root/fs/btrfs/raid56.h
diff options
context:
space:
mode:
authorQu Wenruo <wqu@suse.com>2022-05-13 16:34:30 +0800
committerDavid Sterba <dsterba@suse.com>2022-07-25 17:45:36 +0200
commit0b30f719451ebbf313cdb444a27b00c10cf6e8a5 (patch)
treed5214a96a9d1b31e1d278699d8c29b35dd0246c2 /fs/btrfs/raid56.h
parent6dead96c1a1e091e78ee80a2484279c3861c60d8 (diff)
btrfs: use btrfs_raid_array to calculate number of parity stripes
Use the raid table instead of hard coded values and rename the helper as it is exported. This could make later extension on RAID56 based profiles easier. Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/raid56.h')
-rw-r--r--fs/btrfs/raid56.h12
1 files changed, 1 insertions, 11 deletions
diff --git a/fs/btrfs/raid56.h b/fs/btrfs/raid56.h
index 3b22657ca857..c73bceb2b461 100644
--- a/fs/btrfs/raid56.h
+++ b/fs/btrfs/raid56.h
@@ -155,19 +155,9 @@ struct raid56_bio_trace_info {
u8 stripe_nr;
};
-static inline int nr_parity_stripes(const struct map_lookup *map)
-{
- if (map->type & BTRFS_BLOCK_GROUP_RAID5)
- return 1;
- else if (map->type & BTRFS_BLOCK_GROUP_RAID6)
- return 2;
- else
- return 0;
-}
-
static inline int nr_data_stripes(const struct map_lookup *map)
{
- return map->num_stripes - nr_parity_stripes(map);
+ return map->num_stripes - btrfs_nr_parity_stripes(map->type);
}
#define RAID5_P_STRIPE ((u64)-2)