Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b78e5616 authored by Josef Bacik's avatar Josef Bacik Committed by David Sterba
Browse files

btrfs: dump block_rsv details when dumping space info



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

Reviewed-by: default avatarOmar Sandoval <osandov@fb.com>
Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent d89dbefb
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -8086,6 +8086,15 @@ static noinline int find_free_extent(struct btrfs_fs_info *fs_info,
	return ret;
}

#define DUMP_BLOCK_RSV(fs_info, rsv_name)				\
do {									\
	struct btrfs_block_rsv *__rsv = &(fs_info)->rsv_name;		\
	spin_lock(&__rsv->lock);					\
	btrfs_info(fs_info, #rsv_name ": size %llu reserved %llu",	\
		   __rsv->size, __rsv->reserved);			\
	spin_unlock(&__rsv->lock);					\
} while (0)

static void dump_space_info(struct btrfs_fs_info *fs_info,
			    struct btrfs_space_info *info, u64 bytes,
			    int dump_block_groups)
@@ -8105,6 +8114,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;