btrfs-progs: export raid table helper for sub_stripes

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2021-10-07 00:39:59 +02:00
parent 833ce53872
commit 4f662d74fd
2 changed files with 8 additions and 0 deletions

View File

@ -238,6 +238,13 @@ int btrfs_bg_type_to_nparity(u64 flags)
return btrfs_raid_array[index].nparity;
}
int btrfs_bg_type_to_sub_stripes(u64 flags)
{
const int index = btrfs_bg_flags_to_raid_index(flags);
return btrfs_raid_array[index].sub_stripes;
}
static inline int nr_data_stripes(struct map_lookup *map)
{
return map->num_stripes - btrfs_bg_type_to_nparity(map->type);

View File

@ -311,5 +311,6 @@ int btrfs_bg_type_to_tolerated_failures(u64 flags);
int btrfs_bg_type_to_devs_min(u64 flags);
int btrfs_bg_type_to_ncopies(u64 flags);
int btrfs_bg_type_to_nparity(u64 flags);
int btrfs_bg_type_to_sub_stripes(u64 flags);
#endif