提交 41956753 编写于 作者: D Darrick J. Wong

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: NDarrick J. Wong <djwong@kernel.org>
Reviewed-by: NChristoph Hellwig <hch@lst.de>
上级 9669f51d
...@@ -1571,21 +1571,19 @@ xfs_start_block_reaping( ...@@ -1571,21 +1571,19 @@ xfs_start_block_reaping(
xfs_blockgc_queue(mp); xfs_blockgc_queue(mp);
} }
/* Scan all incore inodes for block preallocations that we can remove. */ /* Scan one incore inode for block preallocations that we can remove. */
static inline int static int
xfs_blockgc_scan( xfs_blockgc_scan_inode(
struct xfs_mount *mp, struct xfs_inode *ip,
struct xfs_eofblocks *eofb) void *args)
{ {
int error; int error;
error = xfs_inode_walk(mp, 0, xfs_inode_free_eofblocks, eofb, error = xfs_inode_free_eofblocks(ip, args);
XFS_ICI_BLOCKGC_TAG);
if (error) if (error)
return error; return error;
error = xfs_inode_walk(mp, 0, xfs_inode_free_cowblocks, eofb, error = xfs_inode_free_cowblocks(ip, args);
XFS_ICI_BLOCKGC_TAG);
if (error) if (error)
return error; return error;
...@@ -1603,7 +1601,8 @@ xfs_blockgc_worker( ...@@ -1603,7 +1601,8 @@ xfs_blockgc_worker(
if (!sb_start_write_trylock(mp->m_super)) if (!sb_start_write_trylock(mp->m_super))
return; return;
error = xfs_blockgc_scan(mp, NULL); error = xfs_inode_walk(mp, 0, xfs_blockgc_scan_inode, NULL,
XFS_ICI_BLOCKGC_TAG);
if (error) if (error)
xfs_info(mp, "preallocation gc worker failed, err=%d", error); xfs_info(mp, "preallocation gc worker failed, err=%d", error);
sb_end_write(mp->m_super); sb_end_write(mp->m_super);
...@@ -1620,7 +1619,8 @@ xfs_blockgc_free_space( ...@@ -1620,7 +1619,8 @@ xfs_blockgc_free_space(
{ {
trace_xfs_blockgc_free_space(mp, eofb, _RET_IP_); 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);
} }
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册