]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
btrfs: zoned: don't account data relocation space-info in statfs free space
authorJohannes Thumshirn <johannes.thumshirn@wdc.com>
Fri, 22 May 2026 09:02:46 +0000 (11:02 +0200)
committerJohannes Thumshirn <johannes.thumshirn@wdc.com>
Tue, 9 Jun 2026 16:22:44 +0000 (18:22 +0200)
Don't account the free space in a data relocation space-info sub-group as
usable free space in statfs.

This is misleading as no user allocations can be made in this space-info
sub-group. It is only a target for relocation.

Fixes: f92ee31e031c ("btrfs: introduce btrfs_space_info sub-group")
Reviewed-by: Boris Burkov <boris@bur.io>
Reviewed-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/super.c

index 9de67276a8edd67f25a1c067f52eae246e44eebe..faa4777119ac23f831ed5aa9e3b6ab8ae0c191cf 100644 (file)
@@ -1740,7 +1740,8 @@ static int btrfs_statfs(struct dentry *dentry, struct kstatfs *buf)
        int mixed = 0;
 
        list_for_each_entry(found, &fs_info->space_info, list) {
-               if (found->flags & BTRFS_BLOCK_GROUP_DATA) {
+               if (found->flags & BTRFS_BLOCK_GROUP_DATA &&
+                   found->subgroup_id != BTRFS_SUB_GROUP_DATA_RELOC) {
                        int i;
 
                        total_free_data += found->disk_total - found->disk_used;