On 4/25/22 8:43 AM, Karel Zak wrote: > > Thanks Andrey, > > the code looks good. > > On Thu, Apr 21, 2022 at 03:09:44PM +0200, Andrey Albershteyn wrote: >> I had a look into other fs, like ext4 and btrfs, to implement FSSIZE >> for them, but I think I don't have enough expertize to do that as >> they have not so trivial metadata overhead calculation :) > > But it would be nice to have ext4 and btrfs too. Maybe Eric can help > you :-) > > Karel For ext4 something like e2fsprogs does is probably ok: static __u64 e2p_free_blocks_count(struct ext2_super_block *super) { return super->s_free_blocks_count | (ext2fs_has_feature_64bit(super) ? (__u64) super->s_free_blocks_hi << 32 : 0); } though I wonder if a little documentation on the intent of the flag is in order; ext4 can return "df" in different ways (see the minixdf and bsddf mount options.) I think best effort seems fine here, and reporting the same number as the ext4 utilities do should be fine. As for btrfs - I'm really not sure what this should return on a multi-device filesystem? -Eric