[PATCH 1/6] xfs: hide most of the incore inode walk interface
From: "Darrick J. Wong" <djwong@kernel.org>
Date: 2021-01-12 00:30:30
Subsystem:
filesystems (vfs and infrastructure), the rest, xfs filesystem · Maintainers:
Alexander Viro, Christian Brauner, Linus Torvalds, Carlos Maiolino
From: Darrick J. Wong <djwong@kernel.org> Hide the incore inode walk interface because callers outside of the icache code don't need to know about iter_flags and radix tags and other implementation details of the incore inode cache. Signed-off-by: Darrick J. Wong <djwong@kernel.org> --- fs/xfs/xfs_icache.c | 27 +++++++++++++++++++++++---- fs/xfs/xfs_icache.h | 9 ++------- fs/xfs/xfs_qm_syscalls.c | 3 +-- 3 files changed, 26 insertions(+), 13 deletions(-)
diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c
index deb99300d171..e6d704a30b29 100644
--- a/fs/xfs/xfs_icache.c
+++ b/fs/xfs/xfs_icache.c@@ -26,6 +26,11 @@ #include <linux/iversion.h> +/* + * flags for incore inode iterator + */ +#define XFS_INODE_WALK_INEW_WAIT 0x1 /* wait on new inodes */ + /* * Allocate and initialise an xfs_inode. */
@@ -888,8 +893,8 @@ xfs_inode_walk_get_perag( * Call the @execute function on all incore inodes matching the radix tree * @tag. */ -int -xfs_inode_walk( +STATIC int +__xfs_inode_walk( struct xfs_mount *mp, int iter_flags, int (*execute)(struct xfs_inode *ip, void *args),
@@ -915,6 +920,20 @@ xfs_inode_walk( return last_error; } +/* + * Walk all incore inodes in the filesystem. Knowledge of radix tree tags + * is hidden and we always wait for INEW inodes. + */ +int +xfs_inode_walk( + struct xfs_mount *mp, + int (*execute)(struct xfs_inode *ip, void *args), + void *args) +{ + return __xfs_inode_walk(mp, XFS_INODE_WALK_INEW_WAIT, execute, args, + XFS_ICI_NO_TAG); +} + /* * Background scanning to trim post-EOF preallocated space. This is queued * based on the 'speculative_prealloc_lifetime' tunable (5m by default).
@@ -1392,7 +1411,7 @@ xfs_icache_free_eofblocks( struct xfs_mount *mp, struct xfs_eofblocks *eofb) { - return xfs_inode_walk(mp, 0, xfs_inode_free_eofblocks, eofb, + return __xfs_inode_walk(mp, 0, xfs_inode_free_eofblocks, eofb, XFS_ICI_EOFBLOCKS_TAG); }
@@ -1642,7 +1661,7 @@ xfs_icache_free_cowblocks( struct xfs_mount *mp, struct xfs_eofblocks *eofb) { - return xfs_inode_walk(mp, 0, xfs_inode_free_cowblocks, eofb, + return __xfs_inode_walk(mp, 0, xfs_inode_free_cowblocks, eofb, XFS_ICI_COWBLOCKS_TAG); }
diff --git a/fs/xfs/xfs_icache.h b/fs/xfs/xfs_icache.h
index 3a4c8b382cd0..0d9f1b5d112c 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,9 +63,9 @@ int xfs_inode_free_quota_cowblocks(struct xfs_inode *ip); void xfs_cowblocks_worker(struct work_struct *); void xfs_queue_cowblocks(struct xfs_mount *); -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, int tag); + void *args); int xfs_icache_inode_is_allocated(struct xfs_mount *mp, struct xfs_trans *tp, xfs_ino_t ino, bool *inuse);
diff --git a/fs/xfs/xfs_qm_syscalls.c b/fs/xfs/xfs_qm_syscalls.c
index ca1b57d291dc..dad4d3fc3df3 100644
--- a/fs/xfs/xfs_qm_syscalls.c
+++ b/fs/xfs/xfs_qm_syscalls.c@@ -795,6 +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_ICI_NO_TAG); + xfs_inode_walk(mp, xfs_dqrele_inode, &flags); }