fstests: btrfs: add a regression test for incorrect inode incompressible flag
[BUG]
Since kernel commit
59615e2c1f63 ("btrfs: reject single block sized
compression early"), a single block write at file offset 0, which can
not be inlined due the inode size, will mark the inode incompressible.
[REGRESSION TEST]
The new regression test will do:
- Create and mount the fs with compression,max_inline=2k
- Do the following operations:
* Truncate the inode to 2 * blocksize
This will rule out any future inlined writes.
* Buffered write [0, 2K)
Which will not be inlined.
* Sync
For affected kernels, this will set the inode with NOCOMPRESS
and reject all future compression on that inode.
* Buffered write [1M, 2M)
For affected kernels, the range will not be compressed due
to the NOCOMPRESS flag.
- Unmount the fs
- Make sure that:
* The inode has no NOCOMPRESS flag
* File extent at file offset 1M is being compressed
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>