[PATCH 07/35] btrfs: dump block_rsv whe dumping space info

Josef Bacik
2018-08-30T21:45:57Z

For enospc_debug having the block rsvs is super helpful to see if we've
done something wrong.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
fs/btrfs/extent-tree.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 80615a579b18..df826f713034 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -7910,6 +7910,15 @@ static noinline int find_free_extent(struct btrfs_fs_info *fs_info,
return ret;
}

+static void dump_block_rsv(struct btrfs_block_rsv *rsv)
+{
+ spin_lock(&rsv->lock);
+ printk(KERN_ERR "%d: size %llu reserved %llu\n",
+ rsv->type, (unsigned long long)rsv->size,
+ (unsigned long long)rsv->reserved);
+ spin_unlock(&rsv->lock);
+}
+
static void dump_space_info(struct btrfs_fs_info *fs_info,
struct btrfs_space_info *info, u64 bytes,
int dump_block_groups)
@@ -7929,6 +7938,12 @@ static void dump_space_info(struct btrfs_fs_info *fs_info,
info->bytes_readonly);
spin_unlock(&info->lock);

+ dump_block_rsv(&fs_info->global_block_rsv);
+ dump_block_rsv(&fs_info->trans_block_rsv);
+ dump_block_rsv(&fs_info->chunk_block_rsv);
+ dump_block_rsv(&fs_info->delayed_block_rsv);
+ dump_block_rsv(&fs_info->delayed_refs_rsv);
+
if (!dump_block_groups)
return;

--
2.14.3