]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commitb4ff01c5661857351de404835fe19274fb7930d1
treed6eff1c66de7391fb4188ee5ee13641e49eb7433
parent0496f614e33c192caa269bd6c62c4136ccb576f7
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 cf8df52e88.
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