Message ID | 30d88cac24cfe0a2aa2a334a3648e9e940ecf3ec.1603736169.git.josef@toxicpanda.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Some block rsv fixes | expand |
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 3602806d71bd..e1332f78d618 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@ -1696,7 +1696,8 @@ static noinline_for_stack int merge_reloc_root(struct reloc_control *rc, * Thus the needed metadata size is at most root_level * nodesize, * and * 2 since we have two trees to COW. */ - min_reserved = fs_info->nodesize * btrfs_root_level(root_item) * 2; + min_reserved = fs_info->nodesize * + (btrfs_root_level(root_item) + 1) * 2; memset(&next_key, 0, sizeof(next_key)); while (1) {
The minimum reserve size was adjusted to take into account the height of the tree we are merging, however we can have a root with a level == 0. What we want is root_level + 1 to get the number of nodes we may have to cow. This fixes the enospc_debug warning pops with btrfs/101. 44d354abf33e ("btrfs: relocation: review the call sites which can be interrupted by signal") Signed-off-by: Josef Bacik <josef@toxicpanda.com> --- fs/btrfs/relocation.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)