1 From david@fromorbit.com Fri Apr 2 11:09:28 2010
2 From: Dave Chinner <david@fromorbit.com>
3 Date: Fri, 12 Mar 2010 09:42:09 +1100
4 Subject: xfs: Avoid inodes in reclaim when flushing from inode cache
7 Message-ID: <1268347337-7160-12-git-send-email-david@fromorbit.com>
9 From: Dave Chinner <david@fromorbit.com>
11 commit 018027be90a6946e8cf3f9b17b5582384f7ed117 upstream
13 The reclaim code will handle flushing of dirty inodes before reclaim
14 occurs, so avoid them when determining whether an inode is a
15 candidate for flushing to disk when walking the radix trees. This
16 is based on a test patch from Christoph Hellwig.
18 Signed-off-by: Dave Chinner <david@fromorbit.com>
19 Reviewed-by: Christoph Hellwig <hch@lst.de>
20 Signed-off-by: Alex Elder <aelder@sgi.com>
21 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
24 fs/xfs/linux-2.6/xfs_sync.c | 31 ++++++++++++++++++-------------
25 1 file changed, 18 insertions(+), 13 deletions(-)
27 --- a/fs/xfs/linux-2.6/xfs_sync.c
28 +++ b/fs/xfs/linux-2.6/xfs_sync.c
29 @@ -179,26 +179,31 @@ xfs_sync_inode_valid(
30 struct xfs_perag *pag)
32 struct inode *inode = VFS_I(ip);
33 + int error = EFSCORRUPTED;
35 /* nothing to sync during shutdown */
36 - if (XFS_FORCED_SHUTDOWN(ip->i_mount)) {
37 - read_unlock(&pag->pag_ici_lock);
38 - return EFSCORRUPTED;
40 + if (XFS_FORCED_SHUTDOWN(ip->i_mount))
43 - /* If we can't get a reference on the inode, it must be in reclaim. */
44 - if (!igrab(inode)) {
45 - read_unlock(&pag->pag_ici_lock);
48 - read_unlock(&pag->pag_ici_lock);
49 + /* avoid new or reclaimable inodes. Leave for reclaim code to flush */
51 + if (xfs_iflags_test(ip, XFS_INEW | XFS_IRECLAIMABLE | XFS_IRECLAIM))
54 - if (is_bad_inode(inode) || xfs_iflags_test(ip, XFS_INEW)) {
55 + /* If we can't grab the inode, it must on it's way to reclaim. */
59 + if (is_bad_inode(inode)) {
66 + /* inode is valid */
69 + read_unlock(&pag->pag_ici_lock);