Skip to content

Commit f0f6771

Browse files
committed
xfs: don't allocate into the data fork for an unshare request
jira LE-3571 Rebuild_History Non-Buildable kernel-4.18.0-553.60.1.el8_10 commit-author Darrick J. Wong <[email protected]> commit 1f1397b 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 <[email protected]> Reviewed-by: Dave Chinner <[email protected]> Signed-off-by: Dave Chinner <[email protected]> (cherry picked from commit 1f1397b) Signed-off-by: Jonathan Maple <[email protected]>
1 parent 989185b commit f0f6771

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

fs/xfs/xfs_iomap.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -955,8 +955,9 @@ xfs_buffered_write_iomap_begin(
955955
if (eof)
956956
imap.br_startoff = end_fsb; /* fake hole until the end */
957957

958-
/* We never need to allocate blocks for zeroing a hole. */
959-
if ((flags & IOMAP_ZERO) && imap.br_startoff > offset_fsb) {
958+
/* We never need to allocate blocks for zeroing or unsharing a hole. */
959+
if ((flags & (IOMAP_UNSHARE | IOMAP_ZERO)) &&
960+
imap.br_startoff > offset_fsb) {
960961
xfs_hole_to_iomap(ip, iomap, offset_fsb, imap.br_startoff);
961962
goto out_unlock;
962963
}

0 commit comments

Comments
 (0)