From a5d4fff0dfa3f315e43a4c67b5db604688149c2e Mon Sep 17 00:00:00 2001 From: David Sterba Date: Thu, 7 Oct 2021 00:07:47 +0200 Subject: [PATCH] btrfs-progs: use btrfs_bg_type_to_nparity in calc_chunk_size Signed-off-by: David Sterba --- cmds/filesystem-usage.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cmds/filesystem-usage.c b/cmds/filesystem-usage.c index cb769135..1e8a3114 100644 --- a/cmds/filesystem-usage.c +++ b/cmds/filesystem-usage.c @@ -816,10 +816,8 @@ static u64 calc_chunk_size(struct chunk_info *ci) return ci->size ; else if (ci->type & BTRFS_BLOCK_GROUP_DUP) return ci->size ; - else if (ci->type & BTRFS_BLOCK_GROUP_RAID5) - return ci->size / (ci->num_stripes -1); - else if (ci->type & BTRFS_BLOCK_GROUP_RAID6) - return ci->size / (ci->num_stripes -2); + else if (ci->type & BTRFS_BLOCK_GROUP_RAID56_MASK) + return ci->size / (ci->num_stripes - btrfs_bg_type_to_nparity(ci->type)); else if (ci->type & BTRFS_BLOCK_GROUP_RAID10) return ci->size / (ci->num_stripes / 2); return ci->size;