]> asedeno.scripts.mit.edu Git - linux.git/commit
xfs: refactor clonerange preparation into a separate helper
authorDarrick J. Wong <darrick.wong@oracle.com>
Fri, 5 Oct 2018 09:04:22 +0000 (19:04 +1000)
committerDave Chinner <david@fromorbit.com>
Fri, 5 Oct 2018 09:04:22 +0000 (19:04 +1000)
commit0d41e1d28c2e969094ef7933b8521f1e08d30251
treec319317290e83f3c74296aaa2bcefdce20a8b4a0
parente55ec4ddbef9897199c307dfb23167e3801fdaf5
xfs: refactor clonerange preparation into a separate helper

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: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/xfs_reflink.c