summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_icache.c
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2021-01-22 16:48:43 -0800
committerDarrick J. Wong <djwong@kernel.org>2021-02-03 09:18:49 -0800
commit419567534e16eb553e7c19eecaa4d03cbc6693be (patch)
treee8ac77fa2a067444e17deb1ca84811dec3f1a596 /fs/xfs/xfs_icache.c
parent9669f51de5c0c93e79257f690d1feaf16ebc179b (diff)
downloadlwn-419567534e16eb553e7c19eecaa4d03cbc6693be.tar.gz
lwn-419567534e16eb553e7c19eecaa4d03cbc6693be.zip
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 <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/xfs/xfs_icache.c')
-rw-r--r--fs/xfs/xfs_icache.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c
index c6ef4d14fb8d..0c0d5779fea0 100644
--- a/fs/xfs/xfs_icache.c
+++ b/fs/xfs/xfs_icache.c
@@ -1571,21 +1571,19 @@ xfs_start_block_reaping(
xfs_blockgc_queue(mp);
}
-/* 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_inode_walk(mp, 0, xfs_inode_free_eofblocks, eofb,
- XFS_ICI_BLOCKGC_TAG);
+ error = xfs_inode_free_eofblocks(ip, args);
if (error)
return error;
- error = xfs_inode_walk(mp, 0, xfs_inode_free_cowblocks, eofb,
- XFS_ICI_BLOCKGC_TAG);
+ error = xfs_inode_free_cowblocks(ip, args);
if (error)
return error;
@@ -1603,7 +1601,8 @@ xfs_blockgc_worker(
if (!sb_start_write_trylock(mp->m_super))
return;
- error = xfs_blockgc_scan(mp, NULL);
+ error = xfs_inode_walk(mp, 0, xfs_blockgc_scan_inode, NULL,
+ XFS_ICI_BLOCKGC_TAG);
if (error)
xfs_info(mp, "preallocation gc worker failed, err=%d", error);
sb_end_write(mp->m_super);
@@ -1620,7 +1619,8 @@ xfs_blockgc_free_space(
{
trace_xfs_blockgc_free_space(mp, eofb, _RET_IP_);
- return xfs_blockgc_scan(mp, eofb);
+ return xfs_inode_walk(mp, 0, xfs_blockgc_scan_inode, eofb,
+ XFS_ICI_BLOCKGC_TAG);
}
/*