Skip to content

Commit 9be0590

Browse files
committed
xfs: remove xfs_inode_ag_iterator_flags
Combine xfs_inode_ag_iterator_flags and xfs_inode_ag_iterator_tag into a single wrapper function since there's only one caller of the _flags variant. Signed-off-by: Darrick J. Wong <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Brian Foster <[email protected]>
1 parent 43d24bc commit 9be0590

File tree

3 files changed

+16
-36
lines changed

3 files changed

+16
-36
lines changed

fs/xfs/xfs_icache.c

Lines changed: 13 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -976,38 +976,22 @@ xfs_cowblocks_worker(
976976
xfs_queue_cowblocks(mp);
977977
}
978978

979-
int
980-
xfs_inode_ag_iterator_flags(
979+
/* Fetch the next (possibly tagged) per-AG structure. */
980+
static inline struct xfs_perag *
981+
xfs_inode_walk_get_perag(
981982
struct xfs_mount *mp,
982-
int (*execute)(struct xfs_inode *ip, int flags,
983-
void *args),
984-
int flags,
985-
void *args,
986-
int iter_flags)
983+
xfs_agnumber_t agno,
984+
int tag)
987985
{
988-
struct xfs_perag *pag;
989-
int error = 0;
990-
int last_error = 0;
991-
xfs_agnumber_t ag;
992-
993-
ag = 0;
994-
while ((pag = xfs_perag_get(mp, ag))) {
995-
ag = pag->pag_agno + 1;
996-
error = xfs_inode_ag_walk(mp, pag, execute, flags, args,
997-
XFS_ICI_NO_TAG, iter_flags);
998-
xfs_perag_put(pag);
999-
if (error) {
1000-
last_error = error;
1001-
if (error == -EFSCORRUPTED)
1002-
break;
1003-
}
1004-
}
1005-
return last_error;
986+
if (tag == XFS_ICI_NO_TAG)
987+
return xfs_perag_get(mp, agno);
988+
return xfs_perag_get_tag(mp, agno, tag);
1006989
}
1007990

1008991
int
1009-
xfs_inode_ag_iterator_tag(
992+
xfs_inode_ag_iterator(
1010993
struct xfs_mount *mp,
994+
int iter_flags,
1011995
int (*execute)(struct xfs_inode *ip, int flags,
1012996
void *args),
1013997
int flags,
@@ -1020,10 +1004,10 @@ xfs_inode_ag_iterator_tag(
10201004
xfs_agnumber_t ag;
10211005

10221006
ag = 0;
1023-
while ((pag = xfs_perag_get_tag(mp, ag, tag))) {
1007+
while ((pag = xfs_inode_walk_get_perag(mp, ag, tag))) {
10241008
ag = pag->pag_agno + 1;
10251009
error = xfs_inode_ag_walk(mp, pag, execute, flags, args, tag,
1026-
0);
1010+
iter_flags);
10271011
xfs_perag_put(pag);
10281012
if (error) {
10291013
last_error = error;
@@ -1543,8 +1527,7 @@ __xfs_icache_free_eofblocks(
15431527
if (eofb && (eofb->eof_flags & XFS_EOF_FLAGS_SYNC))
15441528
flags = SYNC_WAIT;
15451529

1546-
return xfs_inode_ag_iterator_tag(mp, execute, flags,
1547-
eofb, tag);
1530+
return xfs_inode_ag_iterator(mp, 0, execute, flags, eofb, tag);
15481531
}
15491532

15501533
int

fs/xfs/xfs_icache.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,7 @@ int xfs_inode_free_quota_cowblocks(struct xfs_inode *ip);
7171
void xfs_cowblocks_worker(struct work_struct *);
7272
void xfs_queue_cowblocks(struct xfs_mount *);
7373

74-
int xfs_inode_ag_iterator_flags(struct xfs_mount *mp,
75-
int (*execute)(struct xfs_inode *ip, int flags, void *args),
76-
int flags, void *args, int iter_flags);
77-
int xfs_inode_ag_iterator_tag(struct xfs_mount *mp,
74+
int xfs_inode_ag_iterator(struct xfs_mount *mp, int iter_flags,
7875
int (*execute)(struct xfs_inode *ip, int flags, void *args),
7976
int flags, void *args, int tag);
8077

fs/xfs/xfs_qm_syscalls.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,6 @@ xfs_qm_dqrele_all_inodes(
780780
uint flags)
781781
{
782782
ASSERT(mp->m_quotainfo);
783-
xfs_inode_ag_iterator_flags(mp, xfs_dqrele_inode, flags, NULL,
784-
XFS_AGITER_INEW_WAIT);
783+
xfs_inode_ag_iterator(mp, XFS_AGITER_INEW_WAIT, xfs_dqrele_inode,
784+
flags, NULL, XFS_ICI_NO_TAG);
785785
}

0 commit comments

Comments
 (0)