• Darrick J. Wong's avatar
    xfs: fix fallocate functions when rtextsize is larger than 1 · 25219dbf
    Darrick J. Wong authored
    In commit fe341eb1, 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: fe341eb1 ("xfs: ensure that fpunch, fcollapse, and finsert operations are aligned to rt extent size")
    Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
    Reviewed-by: default avatarChandan Babu R <chandanrlinux@gmail.com>
    25219dbf
xfs_linux.h 6.57 KB