linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs-progs: add RAID5/6 support to btrfs fi us
@ 2020-03-18 21:11 Goffredo Baroncelli
  2020-03-18 21:11 ` [PATCH] Add support for the raid5/6 profiles in the btrfs fi us command Goffredo Baroncelli
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Goffredo Baroncelli @ 2020-03-18 21:11 UTC (permalink / raw)
  To: linux-btrfs


Hi all,

this patch adds support for the raid5/6 profiles in the command
'btrfs filesystem usage'.

Until now the problem was that the value r_{data,metadata}_used is not
easy to get for a RAID5/6, because it depends by the number of disks.
And in a filesystem it is possible to have several raid5/6 chunks with a
different number of disks.

In order to bypass this issue, I reworked the code to get rid of these
values where possible and to use the l_{data,metadata}_used ones.
Notably the biggest differences is in how the free space estimation
is computed. Before it was:

	free_estimated = (r_data_chunks - r_data_used) / data_ratio;

After it is:

	free_estimated = l_data_chunks - l_data_used;

which give the same results when there is no mixed raid level, but a
better result in the other case. I have to point out that before in the 
code there was a comment that said the opposite.

The other place where the r_{data,metadata}_used are use is for the
"Used:" field. For this case I estimated these values using the
following formula (only for raid5/6 profiles):

	r_data_used += (double)r_data_chunks * l_data_used /
                               l_data_chunks;

Note that this is not fully accurate. Eg. suppose to have two raid5 chunks,
the first one with 3 disks, the second one with 4 disks, and that each
chunk is 1GB.
r_data_chunks_r56, l_data_used_r56, l_data_chunks_r56 are completely defined,
but real r_data_used is completely different in these two cases:
- the first chunk is full and the second one id empty
- the first chunk is full empty and the second one is full
However now this error affect only the "Used:" field.


So now if you run btrfs fi us in a raid6 filesystem you get:

$ sudo btrfs fi us / 
Overall:
    Device size:		  40.00GiB
    Device allocated:		   8.28GiB
    Device unallocated:		  31.72GiB
    Device missing:		     0.00B
    Used:			   5.00GiB
    Free (estimated):		  17.36GiB	(min: 17.36GiB)
    Data ratio:			      2.00
    Metadata ratio:		      0.00
    Global reserve:		   3.25MiB	(used: 0.00B)

Data,RAID6: Size:4.00GiB, Used:2.50GiB (62.53%)
[...]

Instead before:

$ sudo btrfs fi us /
WARNING: RAID56 detected, not implemented
WARNING: RAID56 detected, not implemented
WARNING: RAID56 detected, not implemented
Overall:
    Device size:		  40.00GiB
    Device allocated:		     0.00B
    Device unallocated:		  40.00GiB
    Device missing:		     0.00B
    Used:			     0.00B
    Free (estimated):		     0.00B	(min: 8.00EiB)
    Data ratio:			      0.00
    Metadata ratio:		      0.00
    Global reserve:		   3.25MiB	(used: 0.00B)

Data,RAID6: Size:4.00GiB, Used:2.50GiB (62.53%)
[...]


I want to point out that this patch should be compatible with my
previous patches set (the ones related to the new ioctl 
BTRFS_IOC_GET_CHUNK_INFO). If both are merged we will have a 'btrfs fi us'
commands with full support a raid5/6 filesystem without needing root
capability.

Comments are welcome.
BR
G.Baroncelli

-- 
gpg @keyserver.linux.it: Goffredo Baroncelli <kreijackATinwind.it>
Key fingerprint BBF5 1610 0B64 DAC6 5F7D  17B2 0EDA 9B37 8B82 E0B5


^ permalink raw reply	[flat|nested] 10+ messages in thread
* Re: [PATCH] btrfs-progs: add RAID5/6 support to btrfs fi us
@ 2020-04-04 19:29 Torstein Eide
  0 siblings, 0 replies; 10+ messages in thread
From: Torstein Eide @ 2020-04-04 19:29 UTC (permalink / raw)
  To: danglingpointerexception, kreijack, linux-btrfs

I like to see all improvements get push upstream. As a user of raid5 i
like to see BTRFS be the best software raid.

This looks like a good improvement to the unfriendliness of  btrfs fi us.

I approve this patch.


- --
Torstein Eide
Torsteine@gmail.com

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

end of thread, other threads:[~2020-05-25 20:40 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-18 21:11 [PATCH] btrfs-progs: add RAID5/6 support to btrfs fi us Goffredo Baroncelli
2020-03-18 21:11 ` [PATCH] Add support for the raid5/6 profiles in the btrfs fi us command Goffredo Baroncelli
2020-03-25 20:12 ` [PATCH] btrfs-progs: add RAID5/6 support to btrfs fi us Goffredo Baroncelli
2020-03-31 21:55   ` DanglingPointer
2020-04-13 10:08 ` Joshua Houghton
2020-04-13 10:28   ` Joshua Houghton
2020-04-13 17:05     ` Goffredo Baroncelli
2020-05-25 13:27 ` David Sterba
2020-05-25 20:40   ` Goffredo Baroncelli
2020-04-04 19:29 Torstein Eide

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).