summaryrefslogtreecommitdiff
path: root/fs/btrfs/space-info.c
diff options
context:
space:
mode:
authorFilipe Manana <fdmanana@suse.com>2023-07-26 18:57:02 +0300
committerDavid Sterba <dsterba@suse.com>2023-08-21 15:52:17 +0300
commit1ff9fee3bd2e865c81d29684dd40a91698f7999b (patch)
treef4344884f3c8d39384feafa2efe6f925bf23489d /fs/btrfs/space-info.c
parente50b122b832bed9f36d459f19fd73d00658f5c1e (diff)
downloadlinux-1ff9fee3bd2e865c81d29684dd40a91698f7999b.tar.xz
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 <fdmanana@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/space-info.c')
-rw-r--r--fs/btrfs/space-info.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
index 54d78e839c01..de0044283e29 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,