generic: Test space allocation when there is only fragmented space
This test case will test if file system works well when handling
large write while available space are all fragmented.
This can expose a bug in a btrfs unmerged patch, which wrongly
modified the delayed allocation code, to exit before allocating all
space, and cause hang when unmounting.
The wrong patch is:
[PATCH v6 1/2] btrfs: Fix metadata underflow caused by btrfs_reloc_clone_csum error
The test case will:
1) Fill small filesystem with page sized small files
All these files has a sequential number as file name
2) Remove files with odd number as file name
This will free almost half of the space
3) Try to write a file which takes 1/8 of the file system
The method to create fragmented fs may not be generic enough, but
should work for most extent based fs. Unless one file system will
allocate extents from both end of its free space.
Cc: Filipe Manana <fdmanana@kernel.org> Cc: Liu Bo <bo.li.liu@oracle.com> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>