]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit - fs/btrfs/extent-tree.c
Btrfs: allocate new chunks if the space is not enough for global rsv
authorMiao Xie <miaox@cn.fujitsu.com>
Thu, 25 Apr 2013 10:12:38 +0000 (10:12 +0000)
committerJosef Bacik <jbacik@fusionio.com>
Mon, 6 May 2013 19:55:17 +0000 (15:55 -0400)
commit3c76cd84e0c0d3ceb094a1020f8c55c2417e18d3
treed6eff1c66de7391fb4188ee5ee13641e49eb7433
parentfc36ed7e0b13955ba66fc56dc5067e67ac105150
Btrfs: allocate new chunks if the space is not enough for global rsv

When running the 208th of xfstests, the fs returned the enospc
error when there was lots of free space in the disk.

By bisect debug, we found it was introduced by commit 96f1bb5777.
This commit makes the space check for the global reservation in
can_overcommit() be inconsistent with should_alloc_chunk().
can_overcommit() requires that the free space is 2 times the size
of the global reservation, or we can't do overcommit. And instead,
we need reclaim some reserved space, and if we still don't have
enough free space, we need allocate a new chunk. But unfortunately,
should_alloc_chunk() just requires that the free space is 1 time
the size of the global reservation, that is we would not try to
allocate a new chunk if the free space size is in the middle of
these two requires, and just return the enospc error. Fix it.

Cc: Jim Schutt <jaschut@sandia.gov>
Cc: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
fs/btrfs/extent-tree.c