From: Filipe Manana Date: Wed, 26 Jul 2023 15:57:02 +0000 (+0100) Subject: btrfs: print available space across all block groups when dumping space info X-Git-Tag: v6.6.7~1678^2~83 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1ff9fee3bd2e865c81d29684dd40a91698f7999b;p=platform%2Fkernel%2Flinux-starfive.git btrfs: print available space across all block groups when dumping space info When dumping a space info also sum the available space for all block groups and then print it. This often useful for debugging -ENOSPC related problems. Signed-off-by: Filipe Manana Signed-off-by: David Sterba --- diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c index 54d78e83..de00442 100644 --- a/fs/btrfs/space-info.c +++ b/fs/btrfs/space-info.c @@ -510,6 +510,7 @@ void btrfs_dump_space_info(struct btrfs_fs_info *fs_info, int dump_block_groups) { struct btrfs_block_group *cache; + u64 total_avail = 0; int index = 0; spin_lock(&info->lock); @@ -537,10 +538,13 @@ again: avail, cache->ro ? "[readonly]" : ""); spin_unlock(&cache->lock); btrfs_dump_free_space(cache, bytes); + total_avail += avail; } if (++index < BTRFS_NR_RAID_TYPES) goto again; up_read(&info->groups_sem); + + btrfs_info(fs_info, "%llu bytes available across all block groups", total_avail); } static inline u64 calc_reclaim_items_nr(const struct btrfs_fs_info *fs_info,