diff mbox series

[3/3] xfs: remove iter_flags parameter from xfs_inode_walk_*

Message ID 161610683632.1887634.9330923612964175378.stgit@magnolia (mailing list archive)
State Superseded
Headers show
Series xfs: reduce indirect function calls in inode walk | expand

Commit Message

Darrick J. Wong March 18, 2021, 10:33 p.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

The sole user of the INEW_WAIT flag to xfs_inode_walk is a caller that
is external to the inode cache.  Since external callers have no business
messing with INEW inodes or inode radix tree tags, we can get rid of the
iter_flag entirely.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 fs/xfs/xfs_icache.c      |   20 ++++++++------------
 fs/xfs/xfs_icache.h      |    7 +------
 fs/xfs/xfs_qm_syscalls.c |    2 +-
 3 files changed, 10 insertions(+), 19 deletions(-)
diff mbox series

Patch

diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c
index 9198c7a7c3ca..563865140a99 100644
--- a/fs/xfs/xfs_icache.c
+++ b/fs/xfs/xfs_icache.c
@@ -732,10 +732,9 @@  xfs_icache_inode_is_allocated(
 STATIC bool
 xfs_inode_walk_ag_grab(
 	struct xfs_inode	*ip,
-	int			flags)
+	int			tag)
 {
 	struct inode		*inode = VFS_I(ip);
-	bool			newinos = !!(flags & XFS_INODE_WALK_INEW_WAIT);
 
 	ASSERT(rcu_read_lock_held());
 
@@ -745,7 +744,7 @@  xfs_inode_walk_ag_grab(
 		goto out_unlock_noent;
 
 	/* avoid new or reclaimable inodes. Leave for reclaim code to flush */
-	if ((!newinos && __xfs_iflags_test(ip, XFS_INEW)) ||
+	if ((tag != XFS_ICI_NO_TAG && __xfs_iflags_test(ip, XFS_INEW)) ||
 	    __xfs_iflags_test(ip, XFS_IRECLAIMABLE | XFS_IRECLAIM))
 		goto out_unlock_noent;
 	spin_unlock(&ip->i_flags_lock);
@@ -781,7 +780,6 @@  inode_walk_fn_to_tag(int (*execute)(struct xfs_inode *ip, void *args))
 STATIC int
 xfs_inode_walk_ag(
 	struct xfs_perag	*pag,
-	int			iter_flags,
 	int			(*execute)(struct xfs_inode *ip, void *args),
 	void			*args)
 {
@@ -827,7 +825,7 @@  xfs_inode_walk_ag(
 		for (i = 0; i < nr_found; i++) {
 			struct xfs_inode *ip = batch[i];
 
-			if (done || !xfs_inode_walk_ag_grab(ip, iter_flags))
+			if (done || !xfs_inode_walk_ag_grab(ip, tag))
 				batch[i] = NULL;
 
 			/*
@@ -855,15 +853,14 @@  xfs_inode_walk_ag(
 		for (i = 0; i < nr_found; i++) {
 			if (!batch[i])
 				continue;
-			if ((iter_flags & XFS_INODE_WALK_INEW_WAIT) &&
-			    xfs_iflags_test(batch[i], XFS_INEW))
-				xfs_inew_wait(batch[i]);
 			switch (tag) {
 			case XFS_ICI_BLOCKGC_TAG:
 				error = xfs_blockgc_scan_inode(batch[i], args);
 				xfs_irele(batch[i]);
 				break;
 			case XFS_ICI_NO_TAG:
+				if (xfs_iflags_test(batch[i], XFS_INEW))
+					xfs_inew_wait(batch[i]);
 				error = execute(batch[i], args);
 				xfs_irele(batch[i]);
 				break;
@@ -914,7 +911,6 @@  xfs_inode_walk_get_perag(
 int
 xfs_inode_walk(
 	struct xfs_mount	*mp,
-	int			iter_flags,
 	int			(*execute)(struct xfs_inode *ip, void *args),
 	void			*args)
 {
@@ -927,7 +923,7 @@  xfs_inode_walk(
 	ag = 0;
 	while ((pag = xfs_inode_walk_get_perag(mp, ag, tag))) {
 		ag = pag->pag_agno + 1;
-		error = xfs_inode_walk_ag(pag, iter_flags, execute, args);
+		error = xfs_inode_walk_ag(pag, execute, args);
 		xfs_perag_put(pag);
 		if (error) {
 			last_error = error;
@@ -1636,7 +1632,7 @@  xfs_blockgc_worker(
 
 	if (!sb_start_write_trylock(mp->m_super))
 		return;
-	error = xfs_inode_walk_ag(pag, 0, xfs_blockgc_scan_inode, NULL);
+	error = xfs_inode_walk_ag(pag, xfs_blockgc_scan_inode, NULL);
 	if (error)
 		xfs_info(mp, "AG %u preallocation gc worker failed, err=%d",
 				pag->pag_agno, error);
@@ -1654,7 +1650,7 @@  xfs_blockgc_free_space(
 {
 	trace_xfs_blockgc_free_space(mp, eofb, _RET_IP_);
 
-	return xfs_inode_walk(mp, 0, xfs_blockgc_scan_inode, eofb);
+	return xfs_inode_walk(mp, xfs_blockgc_scan_inode, eofb);
 }
 
 /*
diff --git a/fs/xfs/xfs_icache.h b/fs/xfs/xfs_icache.h
index a20bb89e3a38..04e59b775432 100644
--- a/fs/xfs/xfs_icache.h
+++ b/fs/xfs/xfs_icache.h
@@ -34,11 +34,6 @@  struct xfs_eofblocks {
 #define XFS_IGET_DONTCACHE	0x4
 #define XFS_IGET_INCORE		0x8	/* don't read from disk or reinit */
 
-/*
- * flags for AG inode iterator
- */
-#define XFS_INODE_WALK_INEW_WAIT	0x1	/* wait on new inodes */
-
 int xfs_iget(struct xfs_mount *mp, struct xfs_trans *tp, xfs_ino_t ino,
 	     uint flags, uint lock_flags, xfs_inode_t **ipp);
 
@@ -68,7 +63,7 @@  void xfs_inode_clear_cowblocks_tag(struct xfs_inode *ip);
 
 void xfs_blockgc_worker(struct work_struct *work);
 
-int xfs_inode_walk(struct xfs_mount *mp, int iter_flags,
+int xfs_inode_walk(struct xfs_mount *mp,
 	int (*execute)(struct xfs_inode *ip, void *args),
 	void *args);
 
diff --git a/fs/xfs/xfs_qm_syscalls.c b/fs/xfs/xfs_qm_syscalls.c
index 2f42ea8a09ab..dad4d3fc3df3 100644
--- a/fs/xfs/xfs_qm_syscalls.c
+++ b/fs/xfs/xfs_qm_syscalls.c
@@ -795,5 +795,5 @@  xfs_qm_dqrele_all_inodes(
 	uint			flags)
 {
 	ASSERT(mp->m_quotainfo);
-	xfs_inode_walk(mp, XFS_INODE_WALK_INEW_WAIT, xfs_dqrele_inode, &flags);
+	xfs_inode_walk(mp, xfs_dqrele_inode, &flags);
 }