btrfs: test unaligned punch hole at ENOSPC
Try to punch hole with unaligned size and offset when the FS is full
and mounted with nodatacow option.
Mainly holes are punched at locations which are unaligned with the
file extent boundaries when the FS is full by data. As the punching
holes at unaligned location will involve truncating blocks instead
of just dropping the extents, it shall involve reserving data and
metadata space for delalloc and so data alloc fails as the FS is
full.
btrfs_punch_hole()
btrfs_truncate_block()
btrfs_check_data_free_space() <-- ENOSPC
We don't fail punch hole if the holes are aligned with the file
extent boundaries as it shall involve just dropping the related
extents, without truncating data extent blocks.
This test was orignally merged as btrfs/172 (commit
4c2c678cd), then
Iremoved by commit
538d8a4bcc78. But it's decided to bring back this
test case, now the problem is better understood and the fix is
available in the ML as below.
Link: https://patchwork.kernel.org/patch/11357415/
Reviewed-by: Filipe Manana <fdmanana@suse.com>
(cherry picked from commit
4c2c678cd56a81a210cb16f9f9347073e91e2fb0)
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>