Commit 1ff9fee3 authored by Filipe Manana's avatar Filipe Manana Committed by David Sterba

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: default avatarFilipe Manana <fdmanana@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent e50b122b
...@@ -510,6 +510,7 @@ void btrfs_dump_space_info(struct btrfs_fs_info *fs_info, ...@@ -510,6 +510,7 @@ void btrfs_dump_space_info(struct btrfs_fs_info *fs_info,
int dump_block_groups) int dump_block_groups)
{ {
struct btrfs_block_group *cache; struct btrfs_block_group *cache;
u64 total_avail = 0;
int index = 0; int index = 0;
spin_lock(&info->lock); spin_lock(&info->lock);
...@@ -537,10 +538,13 @@ void btrfs_dump_space_info(struct btrfs_fs_info *fs_info, ...@@ -537,10 +538,13 @@ void btrfs_dump_space_info(struct btrfs_fs_info *fs_info,
avail, cache->ro ? "[readonly]" : ""); avail, cache->ro ? "[readonly]" : "");
spin_unlock(&cache->lock); spin_unlock(&cache->lock);
btrfs_dump_free_space(cache, bytes); btrfs_dump_free_space(cache, bytes);
total_avail += avail;
} }
if (++index < BTRFS_NR_RAID_TYPES) if (++index < BTRFS_NR_RAID_TYPES)
goto again; goto again;
up_read(&info->groups_sem); 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, static inline u64 calc_reclaim_items_nr(const struct btrfs_fs_info *fs_info,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment