Commit 594ab00b authored by Darrick J. Wong's avatar Darrick J. Wong

xfs: make the icwalk processing functions clean up the grab state

Soon we're going to be adding two new callers to the incore inode walk
code: reclaim of incore inodes, and (later) inactivation of inodes.
Both states operate on inodes that no longer have any VFS state, so we
need to move the xfs_irele calls into the processing functions.

In other words, icwalk processing functions are responsible for cleaning
up whatever state changes are made by the corresponding icwalk igrab
function that picked the inode for processing.
Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
parent d20d5edc
...@@ -811,7 +811,7 @@ xfs_dqrele_igrab( ...@@ -811,7 +811,7 @@ xfs_dqrele_igrab(
} }
/* Drop this inode's dquots. */ /* Drop this inode's dquots. */
static int static void
xfs_dqrele_inode( xfs_dqrele_inode(
struct xfs_inode *ip, struct xfs_inode *ip,
void *priv) void *priv)
...@@ -835,7 +835,7 @@ xfs_dqrele_inode( ...@@ -835,7 +835,7 @@ xfs_dqrele_inode(
ip->i_pdquot = NULL; ip->i_pdquot = NULL;
} }
xfs_iunlock(ip, XFS_ILOCK_EXCL); xfs_iunlock(ip, XFS_ILOCK_EXCL);
return 0; xfs_irele(ip);
} }
/* /*
...@@ -861,7 +861,7 @@ xfs_dqrele_all_inodes( ...@@ -861,7 +861,7 @@ xfs_dqrele_all_inodes(
} }
#else #else
# define xfs_dqrele_igrab(ip) (false) # define xfs_dqrele_igrab(ip) (false)
# define xfs_dqrele_inode(ip, priv) (0) # define xfs_dqrele_inode(ip, priv) ((void)0)
#endif /* CONFIG_XFS_QUOTA */ #endif /* CONFIG_XFS_QUOTA */
/* /*
...@@ -1592,6 +1592,7 @@ xfs_blockgc_scan_inode( ...@@ -1592,6 +1592,7 @@ xfs_blockgc_scan_inode(
unlock: unlock:
if (lockflags) if (lockflags)
xfs_iunlock(ip, lockflags); xfs_iunlock(ip, lockflags);
xfs_irele(ip);
return error; return error;
} }
...@@ -1698,8 +1699,7 @@ xfs_blockgc_free_quota( ...@@ -1698,8 +1699,7 @@ xfs_blockgc_free_quota(
/* /*
* Decide if we want to grab this inode in anticipation of doing work towards * Decide if we want to grab this inode in anticipation of doing work towards
* the goal. If selected, the VFS must hold a reference to this inode, which * the goal.
* will be released after processing.
*/ */
static inline bool static inline bool
xfs_icwalk_igrab( xfs_icwalk_igrab(
...@@ -1716,24 +1716,26 @@ xfs_icwalk_igrab( ...@@ -1716,24 +1716,26 @@ xfs_icwalk_igrab(
} }
} }
/* Process an inode and release it. Return -EAGAIN to skip an inode. */ /*
* Process an inode. Each processing function must handle any state changes
* made by the icwalk igrab function. Return -EAGAIN to skip an inode.
*/
static inline int static inline int
xfs_icwalk_process_inode( xfs_icwalk_process_inode(
enum xfs_icwalk_goal goal, enum xfs_icwalk_goal goal,
struct xfs_inode *ip, struct xfs_inode *ip,
void *args) void *args)
{ {
int error; int error = 0;
switch (goal) { switch (goal) {
case XFS_ICWALK_DQRELE: case XFS_ICWALK_DQRELE:
error = xfs_dqrele_inode(ip, args); xfs_dqrele_inode(ip, args);
break; break;
case XFS_ICWALK_BLOCKGC: case XFS_ICWALK_BLOCKGC:
error = xfs_blockgc_scan_inode(ip, args); error = xfs_blockgc_scan_inode(ip, args);
break; break;
} }
xfs_irele(ip);
return error; return error;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment