linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs-progs: fi-usage: fix RAID10 raw disk usage
@ 2018-06-02 21:26 Hans van Kranenburg
  2018-06-06 14:56 ` David Sterba
  0 siblings, 1 reply; 2+ messages in thread
From: Hans van Kranenburg @ 2018-06-02 21:26 UTC (permalink / raw)
  To: linux-btrfs

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 <hans@knorrie.org>
---
 cmds-fi-usage.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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;
 }
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] btrfs-progs: fi-usage: fix RAID10 raw disk usage
  2018-06-02 21:26 [PATCH] btrfs-progs: fi-usage: fix RAID10 raw disk usage Hans van Kranenburg
@ 2018-06-06 14:56 ` David Sterba
  0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2018-06-06 14:56 UTC (permalink / raw)
  To: Hans van Kranenburg; +Cc: linux-btrfs

On Sat, Jun 02, 2018 at 11:26:41PM +0200, Hans van Kranenburg wrote:
> 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 <hans@knorrie.org>

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-06-06 14:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-02 21:26 [PATCH] btrfs-progs: fi-usage: fix RAID10 raw disk usage Hans van Kranenburg
2018-06-06 14:56 ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).