From: Nikolay Borisov Date: Fri, 15 Dec 2017 10:05:37 +0000 (+0200) Subject: btrfs: Add enospc_debug printing in metadata_reserve_bytes X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=9a3daff320260723b9e64b5b3b9c6592a0cd006a;p=openwrt%2Fstaging%2Fblogic.git btrfs: Add enospc_debug printing in metadata_reserve_bytes Currently when enospc_debug mount option is turned on we do not print any debug info in case metadata reservation failures happen. Fix this by adding the necessary hook in reserve_metadata_bytes. Signed-off-by: Nikolay Borisov Reviewed-by: Qu Wenruo Signed-off-by: David Sterba --- diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 9a677860f64d..85258e85a030 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -5394,10 +5394,15 @@ static int reserve_metadata_bytes(struct btrfs_root *root, !block_rsv_use_bytes(global_rsv, orig_bytes)) ret = 0; } - if (ret == -ENOSPC) + if (ret == -ENOSPC) { trace_btrfs_space_reservation(fs_info, "space_info:enospc", block_rsv->space_info->flags, orig_bytes, 1); + + if (btrfs_test_opt(fs_info, ENOSPC_DEBUG)) + dump_space_info(fs_info, block_rsv->space_info, + orig_bytes, 0); + } return ret; }