path: root/cmds-fi-usage.c
diff options
authorHans van Kranenburg <>2018-06-02 23:26:41 +0200
committerDavid Sterba <>2018-06-07 16:37:40 +0200
commit96af160a0111546f1a7dbad172c8802ca8309e21 (patch)
treec310e5fc75b2de68dafa044b54c8b089b161907e /cmds-fi-usage.c
parent9ff39d48aafe83bd250d557180f931fd774a2586 (diff)
btrfs-progs: fi-usage: fix RAID10 raw disk usage
In case of RAID10, fi usage is reporting half the amount of allocated space and twice the amount of unallocated disk space. Let's fix this. For example, a RAID10 chunk of 3GiB with num_stripes 6, half of the stripes (dev extents) are a mirror of the other half, so the 3GiB of actual data has to be divided by 3, and not 6 to get the size of each of those device extents. Signed-off-by: Hans van Kranenburg <> Signed-off-by: David Sterba <>
Diffstat (limited to 'cmds-fi-usage.c')
1 files changed, 1 insertions, 1 deletions
diff --git a/cmds-fi-usage.c b/cmds-fi-usage.c
index b9a2b1c8..3bd2ccdf 100644
--- a/cmds-fi-usage.c
+++ b/cmds-fi-usage.c
@@ -660,7 +660,7 @@ static u64 calc_chunk_size(struct chunk_info *ci)
else if (ci->type & BTRFS_BLOCK_GROUP_RAID6)
return ci->size / (ci->num_stripes -2);
else if (ci->type & BTRFS_BLOCK_GROUP_RAID10)
- return ci->size / ci->num_stripes;
+ return ci->size / (ci->num_stripes / 2);
return ci->size;