summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_icache.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_icache.c')
-rw-r--r--fs/xfs/xfs_icache.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c
index 32d1110585db..29baf6a59815 100644
--- a/fs/xfs/xfs_icache.c
+++ b/fs/xfs/xfs_icache.c
@@ -744,7 +744,7 @@ xfs_inode_ag_walk_grab(
int flags)
{
struct inode *inode = VFS_I(ip);
- bool newinos = !!(flags & XFS_AGITER_INEW_WAIT);
+ bool newinos = !!(flags & XFS_ICI_WALK_INEW_WAIT);
ASSERT(rcu_read_lock_held());
@@ -788,10 +788,10 @@ out_unlock_noent:
* inodes with the given radix tree @tag.
*/
STATIC int
-xfs_inode_ag_walk(
+xfs_ici_walk_ag(
struct xfs_mount *mp,
struct xfs_perag *pag,
- int (*execute)(struct xfs_inode *ip, void *args),
+ xfs_ici_walk_fn execute,
void *args,
int tag,
int iter_flags)
@@ -864,7 +864,7 @@ restart:
for (i = 0; i < nr_found; i++) {
if (!batch[i])
continue;
- if ((iter_flags & XFS_AGITER_INEW_WAIT) &&
+ if ((iter_flags & XFS_ICI_WALK_INEW_WAIT) &&
xfs_iflags_test(batch[i], XFS_INEW))
xfs_inew_wait(batch[i]);
error = execute(batch[i], args);
@@ -908,11 +908,11 @@ xfs_ici_walk_get_perag(
* Call the @execute function on all incore inodes matching the radix tree
* @tag.
*/
-int
-xfs_inode_ag_iterator(
+STATIC int
+xfs_ici_walk(
struct xfs_mount *mp,
int iter_flags,
- int (*execute)(struct xfs_inode *ip, void *args),
+ xfs_ici_walk_fn execute,
void *args,
int tag)
{
@@ -924,7 +924,7 @@ xfs_inode_ag_iterator(
ag = 0;
while ((pag = xfs_ici_walk_get_perag(mp, ag, tag))) {
ag = pag->pag_agno + 1;
- error = xfs_inode_ag_walk(mp, pag, execute, args, tag,
+ error = xfs_ici_walk_ag(mp, pag, execute, args, tag,
iter_flags);
xfs_perag_put(pag);
if (error) {
@@ -937,6 +937,20 @@ xfs_inode_ag_iterator(
}
/*
+ * Walk all incore inodes in the filesystem. Knowledge of radix tree tags
+ * is hidden and we always wait for INEW inodes.
+ */
+int
+xfs_ici_walk_all(
+ struct xfs_mount *mp,
+ xfs_ici_walk_fn execute,
+ void *args)
+{
+ return xfs_ici_walk(mp, XFS_ICI_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).
*/
@@ -1506,7 +1520,7 @@ xfs_icache_free_eofblocks(
struct xfs_mount *mp,
struct xfs_eofblocks *eofb)
{
- return xfs_inode_ag_iterator(mp, 0, xfs_inode_free_eofblocks, eofb,
+ return xfs_ici_walk(mp, 0, xfs_inode_free_eofblocks, eofb,
XFS_ICI_EOFBLOCKS_TAG);
}
@@ -1756,7 +1770,7 @@ xfs_icache_free_cowblocks(
struct xfs_mount *mp,
struct xfs_eofblocks *eofb)
{
- return xfs_inode_ag_iterator(mp, 0, xfs_inode_free_cowblocks, eofb,
+ return xfs_ici_walk(mp, 0, xfs_inode_free_cowblocks, eofb,
XFS_ICI_COWBLOCKS_TAG);
}