• M
    Btrfs: allocate new chunks if the space is not enough for global rsv · 3c76cd84
    Miao Xie 提交于
    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 96f1bb57.
    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: NMiao Xie <miaox@cn.fujitsu.com>
    Signed-off-by: NJosef Bacik <jbacik@fusionio.com>
    3c76cd84
extent-tree.c 229.4 KB