> Does anyone know if the statfs() syscall is what df uses? There is no call to statfs() in the df source I found here [1].
Yes, it looks like df uses that:
# strace -e statfs df /tmp
statfs("/tmp", {f_type="EXT2_SUPER_MAGIC", f_bsize=4096, f_blocks=4128490, f_bfree=4084457, f_bavail=3874742, f_files=1048576, f_ffree=1048564, f_fsid={1972973117, 2058115910}, f_namelen=255, f_frsize=4096}) = 0
...https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux....
===
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.
===
I'm most interested in the deadlock fix which finally made it in. https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux....
Does this mean df will finally show the correct values for btrfs raid volumes? Does anyone know if the statfs() syscall is what df uses? There is no call to statfs() in the df source I found here [1].
[1] https://searchcode.com/codesearch/view/17947198/