mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git
synced 2024-11-24 04:34:15 +08:00
btrfs-progs: introduce helper for striped profiles
There are several profiles like raid0, raid10, raid5 and raid6 that can span as many devices as possible and need special handling for the stripe calculations. Provide a helper to identify the profiles in a simple way. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
a25a5cc2c0
commit
bc28dc6bea
@ -245,6 +245,17 @@ int btrfs_bg_type_to_sub_stripes(u64 flags)
|
||||
return btrfs_raid_array[index].sub_stripes;
|
||||
}
|
||||
|
||||
/*
|
||||
* Number of stripes is not fixed and depends on the number of devices,
|
||||
* utilizing as many as possible (RAID0/RAID10/RAID5/RAID6/...).
|
||||
*/
|
||||
bool btrfs_bg_type_is_stripey(u64 flags)
|
||||
{
|
||||
const int index = btrfs_bg_flags_to_raid_index(flags);
|
||||
|
||||
return btrfs_raid_array[index].devs_max == 0;
|
||||
}
|
||||
|
||||
u64 btrfs_bg_flags_for_device_num(int number)
|
||||
{
|
||||
int i;
|
||||
|
@ -313,5 +313,6 @@ 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);
|
||||
u64 btrfs_bg_flags_for_device_num(int number);
|
||||
bool btrfs_bg_type_is_stripey(u64 flags);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user