Skip to contentSkip to conversation

use xfs_reclaim_all in xfs_syncsub

RFC PATCH New Christoph Hellwig 1 participant 1 message Apr 24, 2007 XFS filesystem

lore
Share & tools
lore
#0 lore raw

RFC PATCH 2/3 use xfs_reclaim_all in xfs_syncsub

xfs_sync_inodes currently opencodes xfs_finish_reclaim_all, except using an m_inodes walk and checking for a NULL vnode instead of walking m_del_inodes. Change the code in xfs_syncsub to always call xfs_finish_reclaim_all, and remove the code dealing with deleted inodes without vnode from xfs_sync_inodes.

fs/xfs/xfs_vfsops.c +8 -31
Index: linux-2.6/fs/xfs/xfs_vfsops.c
===================================================================
@@ -1018,36 +1018,15 @@ xfs_sync_inodes(
 			continue;
 		}
 
-		vp = XFS_ITOV_NULL(ip);
-
 		/*
-		 * If the vnode is gone then this is being torn down,
-		 * call reclaim if it is flushed, else let regular flush
-		 * code deal with it later in the loop.
+		 * Inodes on the delayed reclaim list are beeing dealt
+		 * with in xfs_reclaim_all.  One may have sneaked in
+		 * here after we dropped the mount ilock, but we'll leave
+		 * them to the next xfs_reclaim_all call.
 		 */
-
+		vp = XFS_ITOV_NULL(ip);
 		if (vp == NULL) {
-			/* Skip ones already in reclaim */
-			if (ip->i_flags & XFS_IRECLAIM) {
-				ip = ip->i_mnext;
-				continue;
-			}
-			if (xfs_ilock_nowait(ip, XFS_ILOCK_EXCL) == 0) {
-				ip = ip->i_mnext;
-			} else if ((xfs_ipincount(ip) == 0) &&
-				    xfs_iflock_nowait(ip)) {
-				IPOINTER_INSERT(ip, mp);
-
-				xfs_finish_reclaim(ip, 1,
-						XFS_IFLUSH_DELWRI_ELSE_ASYNC);
-
-				XFS_MOUNT_ILOCK(mp);
-				mount_locked = B_TRUE;
-				IPOINTER_REMOVE(ip, mp);
-			} else {
-				xfs_iunlock(ip, XFS_ILOCK_EXCL);
-				ip = ip->i_mnext;
-			}
+			ip = ip->i_mnext;
 			continue;
 		}
 
@@ -1434,10 +1413,8 @@ xfs_syncsub(
 	xfs_log_force(mp, (xfs_lsn_t)0, log_flags);
 
 	if (flags & (SYNC_ATTR|SYNC_DELWRI)) {
-		if (flags & SYNC_BDFLUSH)
-			xfs_finish_reclaim_all(mp, 1,
-					XFS_IFLUSH_DELWRI_ELSE_ASYNC);
-		else
+		xfs_finish_reclaim_all(mp, 1, XFS_IFLUSH_DELWRI_ELSE_ASYNC);
+		if (!(flags & SYNC_BDFLUSH))
 			error = xfs_sync_inodes(mp, flags, bypassed);
 	}