xfs: don't allocate into the data fork for an unshare request
authorDarrick J. Wong <djwong@kernel.org>
Mon, 1 May 2023 23:14:51 +0000 (09:14 +1000)
committerDave Chinner <dchinner@redhat.com>
Mon, 1 May 2023 23:14:51 +0000 (09:14 +1000)
commit1f1397b7218d7f8e53e33c6b58cbf9601cd2d8e6
treeba31b944b970f221adae3cc8f530af1eebd3d364
parent397b2d7e0f3e28bbeaa05cf8e10d0fd601f446f4
xfs: don't allocate into the data fork for an unshare request

For an unshare request, we only have to take action if the data fork has
a shared mapping.  We don't care if someone else set up a cow operation.
If we find nothing in the data fork, return a hole to avoid allocating
space.

Note that fallocate will replace the delalloc reservation with an
unwritten extent anyway, so this has no user-visible effects outside of
avoiding unnecessary updates.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/xfs_iomap.c