mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
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>
This commit is contained in:
committed by
Dave Chinner
parent
397b2d7e0f
commit
1f1397b721
@@ -1006,8 +1006,9 @@ xfs_buffered_write_iomap_begin(
|
|||||||
if (eof)
|
if (eof)
|
||||||
imap.br_startoff = end_fsb; /* fake hole until the end */
|
imap.br_startoff = end_fsb; /* fake hole until the end */
|
||||||
|
|
||||||
/* We never need to allocate blocks for zeroing a hole. */
|
/* We never need to allocate blocks for zeroing or unsharing a hole. */
|
||||||
if ((flags & IOMAP_ZERO) && imap.br_startoff > offset_fsb) {
|
if ((flags & (IOMAP_UNSHARE | IOMAP_ZERO)) &&
|
||||||
|
imap.br_startoff > offset_fsb) {
|
||||||
xfs_hole_to_iomap(ip, iomap, offset_fsb, imap.br_startoff);
|
xfs_hole_to_iomap(ip, iomap, offset_fsb, imap.br_startoff);
|
||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user