btrfs: test unaligned punch hole at ENOSPC
authorAnand Jain <anand.jain@oracle.com>
Sun, 30 Sep 2018 01:39:52 +0000 (09:39 +0800)
committerEryu Guan <guaneryu@gmail.com>
Sat, 6 Oct 2018 09:40:09 +0000 (17:40 +0800)
commit4c2c678cd56a81a210cb16f9f9347073e91e2fb0
tree71556b59bd2ff3153ae55a769dab26130917d62d
parent1895cf6b659e8fc6d3e3c696319054be0dba9249
btrfs: test unaligned punch hole at ENOSPC

Try to punch hole with unaligned size and offset when the FS is
full. 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.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/btrfs/172 [new file with mode: 0755]
tests/btrfs/172.out [new file with mode: 0644]
tests/btrfs/group