summaryrefslogtreecommitdiff
path: root/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'utils.c')
-rw-r--r--utils.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/utils.c b/utils.c
index 4b8a8264..eede72f4 100644
--- a/utils.c
+++ b/utils.c
@@ -2354,6 +2354,24 @@ int test_num_disk_vs_raid(u64 metadata_profile, u64 data_profile,
return 0;
}
+int group_profile_max_safe_loss(u64 flags)
+{
+ switch (flags & BTRFS_BLOCK_GROUP_PROFILE_MASK) {
+ case 0: /* single */
+ case BTRFS_BLOCK_GROUP_DUP:
+ case BTRFS_BLOCK_GROUP_RAID0:
+ return 0;
+ case BTRFS_BLOCK_GROUP_RAID1:
+ case BTRFS_BLOCK_GROUP_RAID5:
+ case BTRFS_BLOCK_GROUP_RAID10:
+ return 1;
+ case BTRFS_BLOCK_GROUP_RAID6:
+ return 2;
+ default:
+ return -1;
+ }
+}
+
/* Check if disk is suitable for btrfs
* returns:
* 1: something is wrong, estr provides the error