diff options
author | Qu Wenruo <wqu@suse.com> | 2022-05-13 10:34:30 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2022-07-25 17:45:36 +0200 |
commit | 0b30f719451ebbf313cdb444a27b00c10cf6e8a5 (patch) | |
tree | d5214a96a9d1b31e1d278699d8c29b35dd0246c2 /fs/btrfs/volumes.c | |
parent | btrfs: use btrfs_chunk_max_errors() to replace tolerance calculation (diff) | |
download | linux-0b30f719451ebbf313cdb444a27b00c10cf6e8a5.tar.xz linux-0b30f719451ebbf313cdb444a27b00c10cf6e8a5.zip |
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/volumes.c')
-rw-r--r-- | fs/btrfs/volumes.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 75a59423a1bf..e40c0d59c4a0 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -182,6 +182,13 @@ const char *btrfs_bg_type_to_raid_name(u64 flags) return btrfs_raid_array[index].raid_name; } +int btrfs_nr_parity_stripes(u64 type) +{ + enum btrfs_raid_types index = btrfs_bg_flags_to_raid_index(type); + + return btrfs_raid_array[index].nparity; +} + /* * Fill @buf with textual description of @bg_flags, no more than @size_buf * bytes including terminating null byte. |