aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2022-06-23 16:57:00 +0200
committerDavid Sterba <dsterba@suse.com>2022-07-25 17:45:38 +0200
commitd09cb9e18845c7ba5864282c7cc13c3cabad04f0 (patch)
treec8f4e6852f9ad5c8e578afcedd372f7ecede4f29
parentbtrfs: properly flag filesystem with BTRFS_FEATURE_INCOMPAT_BIG_METADATA (diff)
downloadlinux-dev-d09cb9e18845c7ba5864282c7cc13c3cabad04f0.tar.xz
linux-dev-d09cb9e18845c7ba5864282c7cc13c3cabad04f0.zip
btrfs: use mask for all RAID1* profiles in btrfs_calc_avail_data_space
There's a sequence of hard coded values for RAID1 profiles that are already stored in the raid_attr table that should be used instead. Reviewed-by: Nikolay Borisov <nborisov@suse.com> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--fs/btrfs/super.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 41652dcd16f4..4c7089b1681b 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -2243,12 +2243,8 @@ static inline int btrfs_calc_avail_data_space(struct btrfs_fs_info *fs_info,
if (type & BTRFS_BLOCK_GROUP_RAID0)
num_stripes = nr_devices;
- else if (type & BTRFS_BLOCK_GROUP_RAID1)
- num_stripes = 2;
- else if (type & BTRFS_BLOCK_GROUP_RAID1C3)
- num_stripes = 3;
- else if (type & BTRFS_BLOCK_GROUP_RAID1C4)
- num_stripes = 4;
+ else if (type & BTRFS_BLOCK_GROUP_RAID1_MASK)
+ num_stripes = rattr->ncopies;
else if (type & BTRFS_BLOCK_GROUP_RAID10)
num_stripes = 4;