[PATCH 4/6] [XFS] Factor out inode validation for reclaim

Dave Chinner david at fromorbit.com
Sun Mar 15 06:46:41 CDT 2009


Separate the validation of inodes found by the radix
tree walk from the radix tree lookup.

Signed-off-by: Dave Chinner <david at fromorbit.com>
---
 fs/xfs/linux-2.6/xfs_sync.c |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/fs/xfs/linux-2.6/xfs_sync.c b/fs/xfs/linux-2.6/xfs_sync.c
index a83438a..1fa29de 100644
--- a/fs/xfs/linux-2.6/xfs_sync.c
+++ b/fs/xfs/linux-2.6/xfs_sync.c
@@ -711,6 +711,18 @@ xfs_inode_clear_reclaim_tag(
 	xfs_put_perag(mp, pag);
 }
 
+static int
+xfs_reclaim_inode_valid(
+	xfs_mount_t	*mp,
+	xfs_inode_t	*ip)
+{
+	ASSERT(xfs_iflags_test(ip, (XFS_IRECLAIMABLE|XFS_IRECLAIM)));
+
+	/* ignore if already under reclaim */
+	if (xfs_iflags_test(ip, XFS_IRECLAIM))
+		return -ENOENT;
+	return 0;
+}
 
 STATIC void
 xfs_reclaim_inodes_ag(
@@ -729,6 +741,8 @@ restart:
 	first_index = 0;
 	skipped = 0;
 	do {
+		int	error;
+
 		/*
 		 * use a gang lookup to find the next inode in the tree
 		 * as the tree is sparse and a gang lookup walks to find
@@ -756,8 +770,8 @@ restart:
 			break;
 		}
 
-		/* ignore if already under reclaim */
-		if (xfs_iflags_test(ip, XFS_IRECLAIM)) {
+		error = xfs_reclaim_inode_valid(mp, ip);
+		if (error) {
 			read_unlock(&pag->pag_ici_lock);
 			continue;
 		}
-- 
1.6.2




More information about the xfs mailing list