btrfs: adjust statfs calculations according to raid profiles
authorDavid Sterba <dsterba@suse.cz>
Tue, 1 Jul 2014 14:21:33 +0000 (16:21 +0200)
committerChris Mason <clm@fb.com>
Fri, 15 Aug 2014 14:43:10 +0000 (07:43 -0700)
commitba7b6e62f420f5a8832bc161ab0c7ba767f65b3d
tree7ecd471565cba20fd416ec2bcfbc527ca260fb27
parent19583ca584d6f574384e17fe7613dfaeadcdc4a6
btrfs: adjust statfs calculations according to raid profiles

This has been discussed in thread:
http://thread.gmane.org/gmane.comp.file-systems.btrfs/32528

and this patch implements this proposal:
http://thread.gmane.org/gmane.comp.file-systems.btrfs/32536

Works fine for "clean" raid profiles where the raid factor correction
does the right job. Otherwise it's pessimistic and may show low space
although there's still some left.

The df nubmers are lightly wrong in case of mixed block groups, but this
is not a major usecase and can be addressed later.

The RAID56 numbers are wrong almost the same way as before and will be
addressed separately.

CC: Hugo Mills <hugo@carfax.org.uk>
CC: cwillu <cwillu@cwillu.com>
CC: Josef Bacik <jbacik@fb.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/super.c