aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorDave Chinner <david@fromorbit.com>2010-01-10 18:51:46 -0500
committerAlex Elder <aelder@sgi.com>2010-01-15 14:44:21 -0500
commit018027be90a6946e8cf3f9b17b5582384f7ed117 (patch)
treea8816b9884e21eab9cb3342af9de9ddc28f9f0de /fs/xfs
parentc8e20be020f234c8d492927a424a7d8bbefd5b5d (diff)
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: Dave Chinner <david@fromorbit.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Alex Elder <aelder@sgi.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/linux-2.6/xfs_sync.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/fs/xfs/linux-2.6/xfs_sync.c b/fs/xfs/linux-2.6/xfs_sync.c
index e19d25555c3f..1f5e4bb5e970 100644
--- a/fs/xfs/linux-2.6/xfs_sync.c
+++ b/fs/xfs/linux-2.6/xfs_sync.c
@@ -180,26 +180,31 @@ xfs_sync_inode_valid(
180 struct xfs_perag *pag) 180 struct xfs_perag *pag)
181{ 181{
182 struct inode *inode = VFS_I(ip); 182 struct inode *inode = VFS_I(ip);
183 int error = EFSCORRUPTED;
183 184
184 /* nothing to sync during shutdown */ 185 /* nothing to sync during shutdown */
185 if (XFS_FORCED_SHUTDOWN(ip->i_mount)) { 186 if (XFS_FORCED_SHUTDOWN(ip->i_mount))
186 read_unlock(&pag->pag_ici_lock); 187 goto out_unlock;
187 return EFSCORRUPTED;
188 }
189 188
190 /* If we can't get a reference on the inode, it must be in reclaim. */ 189 /* avoid new or reclaimable inodes. Leave for reclaim code to flush */
191 if (!igrab(inode)) { 190 error = ENOENT;
192 read_unlock(&pag->pag_ici_lock); 191 if (xfs_iflags_test(ip, XFS_INEW | XFS_IRECLAIMABLE | XFS_IRECLAIM))
193 return ENOENT; 192 goto out_unlock;
194 }
195 read_unlock(&pag->pag_ici_lock);
196 193
197 if (is_bad_inode(inode) || xfs_iflags_test(ip, XFS_INEW)) { 194 /* If we can't grab the inode, it must on it's way to reclaim. */
195 if (!igrab(inode))
196 goto out_unlock;
197
198 if (is_bad_inode(inode)) {
198 IRELE(ip); 199 IRELE(ip);
199 return ENOENT; 200 goto out_unlock;
200 } 201 }
201 202
202 return 0; 203 /* inode is valid */
204 error = 0;
205out_unlock:
206 read_unlock(&pag->pag_ici_lock);
207 return error;
203} 208}
204 209
205STATIC int 210STATIC int