On 5/25/20 3:27 PM, David Sterba wrote:
On Wed, Mar 18, 2020 at 10:11:56PM +0100, Goffredo Baroncelli wrote: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.I'd like to get the raid56 'fi du' fixed but the way you implement it seems to be a too big leap. I've tried to review this patch several times but always got the impression that reworking the calculations to make it work for some profiles will most likely break something else. It has happened in the past.
I understand your fear. Frankly speaking this code is quite complex. More than it should be (even without the raid56 support). I am looking for a solution less intrusive. Let me few days and I will update the patch. Then we can discuss its validity.
So, let's start with the case where the filesystem does not have multiple profiles per block group type, eg. just raid5 for data and calculate that. If this also covers the raid56 case with different stripe counts, then good but as this is special case I won't mind addressing it separately. The general case of multiple profiles per type is probably an intermediate state of converting profiles, we can return something sane if possible or warn as what we have now.
Another possibility is when a drive is added and a balance is not performed. However this should be "safe" because it would underestimate the free space.
I'm fine if you say you're not going to implement that.
I want to work on that. -- gpg @keyserver.linux.it: Goffredo Baroncelli <kreijackATinwind.it> Key fingerprint BBF5 1610 0B64 DAC6 5F7D 17B2 0EDA 9B37 8B82 E0B5
