summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2021-03-23 16:59:31 -0700
committerDarrick J. Wong <djwong@kernel.org>2021-03-25 16:59:58 -0700
commit054ed728cd5e81ca3af670eb5f2b8c9b34480b09 (patch)
treed7fa54e82ad1694ad2b64cceb2d007307ee9eb7c
parent06f1b39efa6825c89ce4739a8c80a5d905732937 (diff)
xfs: move the xfs_can_free_eofblocks call under the IOLOCK
In xfs_inode_free_eofblocks, move the xfs_can_free_eofblocks call further down in the function to the point where we have taken the IOLOCK. This is preparation for the next patch, where we will need that lock (or equivalent) so that we can check if there are any post-eof blocks to clean out. Signed-off-by: Darrick J. Wong <djwong@kernel.org>
-rw-r--r--fs/xfs/xfs_icache.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c
index 2fd4a39acb46..3c81daca0e9a 100644
--- a/fs/xfs/xfs_icache.c
+++ b/fs/xfs/xfs_icache.c
@@ -1296,13 +1296,6 @@ xfs_inode_free_eofblocks(
if (!xfs_iflags_test(ip, XFS_IEOFBLOCKS))
return 0;
- if (!xfs_can_free_eofblocks(ip, false)) {
- /* inode could be preallocated or append-only */
- trace_xfs_inode_free_eofblocks_invalid(ip);
- xfs_inode_clear_eofblocks_tag(ip);
- return 0;
- }
-
/*
* If the mapping is dirty the operation can block and wait for some
* time. Unless we are waiting, skip it.
@@ -1324,7 +1317,13 @@ xfs_inode_free_eofblocks(
}
*lockflags |= XFS_IOLOCK_EXCL;
- return xfs_free_eofblocks(ip);
+ if (xfs_can_free_eofblocks(ip, false))
+ return xfs_free_eofblocks(ip);
+
+ /* inode could be preallocated or append-only */
+ trace_xfs_inode_free_eofblocks_invalid(ip);
+ xfs_inode_clear_eofblocks_tag(ip);
+ return 0;
}
/*