提交 018027be 编写于 作者: D Dave Chinner 提交者: Alex Elder

xfs: Avoid inodes in reclaim when flushing from inode cache

The reclaim code will handle flushing of dirty inodes before reclaim
occurs, so avoid them when determining whether an inode is a
candidate for flushing to disk when walking the radix trees.  This
is based on a test patch from Christoph Hellwig.
Signed-off-by: NDave Chinner <david@fromorbit.com>
Reviewed-by: NChristoph Hellwig <hch@lst.de>
Signed-off-by: NAlex Elder <aelder@sgi.com>
上级 c8e20be0
...@@ -180,26 +180,31 @@ xfs_sync_inode_valid( ...@@ -180,26 +180,31 @@ xfs_sync_inode_valid(
struct xfs_perag *pag) struct xfs_perag *pag)
{ {
struct inode *inode = VFS_I(ip); struct inode *inode = VFS_I(ip);
int error = EFSCORRUPTED;
/* nothing to sync during shutdown */ /* nothing to sync during shutdown */
if (XFS_FORCED_SHUTDOWN(ip->i_mount)) { if (XFS_FORCED_SHUTDOWN(ip->i_mount))
read_unlock(&pag->pag_ici_lock); goto out_unlock;
return EFSCORRUPTED;
}
/* If we can't get a reference on the inode, it must be in reclaim. */ /* avoid new or reclaimable inodes. Leave for reclaim code to flush */
if (!igrab(inode)) { error = ENOENT;
read_unlock(&pag->pag_ici_lock); if (xfs_iflags_test(ip, XFS_INEW | XFS_IRECLAIMABLE | XFS_IRECLAIM))
return ENOENT; goto out_unlock;
}
read_unlock(&pag->pag_ici_lock);
if (is_bad_inode(inode) || xfs_iflags_test(ip, XFS_INEW)) { /* If we can't grab the inode, it must on it's way to reclaim. */
if (!igrab(inode))
goto out_unlock;
if (is_bad_inode(inode)) {
IRELE(ip); IRELE(ip);
return ENOENT; goto out_unlock;
} }
return 0; /* inode is valid */
error = 0;
out_unlock:
read_unlock(&pag->pag_ici_lock);
return error;
} }
STATIC int STATIC int
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册