summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2020-02-19 17:02:06 -0800
committerDarrick J. Wong <darrick.wong@oracle.com>2020-06-01 21:16:35 -0700
commit3e7aa2d6440bd74d3c8f032105589a2e9d9ada3c (patch)
tree2f0bb440906792b31e5b7145632c70400c25e9c4
parent1814cead6e5ffa62b5cd421b9bbdcd5c130bc194 (diff)
xfs: only walk the incore inode tree once per blockgc scan
Perform background block preallocation gc scans more efficiently by walking the incore inode tree once. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-rw-r--r--fs/xfs/xfs_icache.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c
index aae2c142042e..46804e4c69ee 100644
--- a/fs/xfs/xfs_icache.c
+++ b/fs/xfs/xfs_icache.c
@@ -981,19 +981,29 @@ xfs_queue_blockgc(
rcu_read_unlock();
}
-/* Scan all incore inodes for block preallocations that we can remove. */
-static inline int
-xfs_blockgc_scan(
- struct xfs_mount *mp,
- struct xfs_eofblocks *eofb)
+/* Scan one incore inode for block preallocations that we can remove. */
+static int
+xfs_blockgc_scan_inode(
+ struct xfs_inode *ip,
+ void *args)
{
int error;
- error = xfs_icache_free_eofblocks(mp, eofb);
+ error = xfs_inode_free_eofblocks(ip, args);
if (error && error != -EAGAIN)
return error;
- return xfs_icache_free_cowblocks(mp, eofb);
+ return xfs_inode_free_cowblocks(ip, args);
+}
+
+/* Scan all incore inodes for block preallocations that we can remove. */
+static inline int
+xfs_blockgc_scan(
+ struct xfs_mount *mp,
+ struct xfs_eofblocks *eofb)
+{
+ return __xfs_inode_walk(mp, 0, xfs_blockgc_scan_inode, eofb,
+ XFS_ICI_BLOCK_GC_TAG);
}
/* Background worker that trims preallocated space. */