]> git.baikalelectronics.ru Git - kernel.git/commit
xfs: fix fallocate functions when rtextsize is larger than 1
authorDarrick J. Wong <darrick.wong@oracle.com>
Fri, 9 Oct 2020 23:42:59 +0000 (16:42 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Wed, 21 Oct 2020 16:05:19 +0000 (09:05 -0700)
commit6bd051cfb4bd58f05b11e52e3b63108a28dbf26b
tree490288634e81fba1d44c642d5d6fe9b46dee3995
parent15784e0ea09c237685e0a0a79a878802a7ae4627
xfs: fix fallocate functions when rtextsize is larger than 1

In commit 49047e5ba035, I forgot that xfs_free_file_space isn't strictly
a "remove mapped blocks" function.  It is actually a function to zero
file space by punching out the middle and writing zeroes to the
unaligned ends of the specified range.  Therefore, putting a rtextsize
alignment check in that function is wrong because that breaks unaligned
ZERO_RANGE on the realtime volume.

Furthermore, xfs_file_fallocate already has alignment checks for the
functions require the file range to be aligned to the size of a
fundamental allocation unit (which is 1 FSB on the data volume and 1 rt
extent on the realtime volume).  Create a new helper to check fallocate
arguments against the realtiem allocation unit size, fix the fallocate
frontend to use it, fix free_file_space to delete the correct range, and
remove a now redundant check from insert_file_space.

NOTE: The realtime extent size is not required to be a power of two!

Fixes: 49047e5ba035 ("xfs: ensure that fpunch, fcollapse, and finsert operations are aligned to rt extent size")
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com>
fs/xfs/xfs_bmap_util.c
fs/xfs/xfs_file.c
fs/xfs/xfs_linux.h