[4/6] xfs: only walk the incore inode tree once per blockgc scan
diff mbox series

Message ID 157784090300.1361683.14080722798395096534.stgit@magnolia
State New
Headers show
Series
  • xfs: consolidate posteof and cowblocks cleanup
Related show

Commit Message

Darrick J. Wong Jan. 1, 2020, 1:08 a.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

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>
---
 fs/xfs/xfs_icache.c |   24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

Patch
diff mbox series

diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c
index 133b88c6681b..b930ce69e055 100644
--- a/fs/xfs/xfs_icache.c
+++ b/fs/xfs/xfs_icache.c
@@ -973,19 +973,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_ici_walk(mp, 0, xfs_blockgc_scan_inode, eofb,
+			XFS_ICI_BLOCK_GC_TAG);
 }
 
 /* Background worker that trims preallocated space. */