• Darrick J. Wong's avatar
    xfs: refactor clonerange preparation into a separate helper · 0d41e1d2
    Darrick J. Wong authored
    Refactor all the reflink preparation steps into a separate helper
    that we'll use to land all the upcoming fixes for insufficient input
    checks.
    
    This rework also moves the invalidation of the destination range to
    the prep function so that it is done before the range is remapped.
    This ensures that nobody can access the data in range being remapped
    until the remap is complete.
    
    [dgc: fix xfs_reflink_remap_prep() return value and caller check to
    handle vfs_clone_file_prep_inodes() returning 0 to mean "nothing to
    do". ]
    
    [dgc: make sure length changed by vfs_clone_file_prep_inodes() gets
    propagated back to XFS code that does the remapping. ]
    Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
    Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
    Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
    0d41e1d2
xfs_reflink.c 43.9 KB