diff mbox series

[12/12] xfs: rearrange xfs_inode_walk_ag parameters

Message ID 159011608512.77079.1442881398167792783.stgit@magnolia (mailing list archive)
State Accepted
Headers show
Series xfs: refactor incore inode walking | expand

Commit Message

Darrick J. Wong May 22, 2020, 2:54 a.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

The perag structure already has a pointer to the xfs_mount, so we don't
need to pass that separately and can drop it.  Having done that, move
iter_flags so that the argument order is the same between xfs_inode_walk
and xfs_inode_walk_ag.  The latter will make things less confusing for a
future patch that enables background scanning work to be done in
parallel.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 fs/xfs/xfs_icache.c |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Comments

Christoph Hellwig May 22, 2020, 6:39 a.m. UTC | #1
On Thu, May 21, 2020 at 07:54:45PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> The perag structure already has a pointer to the xfs_mount, so we don't
> need to pass that separately and can drop it.  Having done that, move
> iter_flags so that the argument order is the same between xfs_inode_walk
> and xfs_inode_walk_ag.  The latter will make things less confusing for a
> future patch that enables background scanning work to be done in
> parallel.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>
Brian Foster May 22, 2020, 12:23 p.m. UTC | #2
On Thu, May 21, 2020 at 07:54:45PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> The perag structure already has a pointer to the xfs_mount, so we don't
> need to pass that separately and can drop it.  Having done that, move
> iter_flags so that the argument order is the same between xfs_inode_walk
> and xfs_inode_walk_ag.  The latter will make things less confusing for a
> future patch that enables background scanning work to be done in
> parallel.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---

Reviewed-by: Brian Foster <bfoster@redhat.com>

>  fs/xfs/xfs_icache.c |    9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> 
> diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c
> index baf59087caa5..fbd77467bb4d 100644
> --- a/fs/xfs/xfs_icache.c
> +++ b/fs/xfs/xfs_icache.c
> @@ -797,13 +797,13 @@ xfs_inode_walk_ag_grab(
>   */
>  STATIC int
>  xfs_inode_walk_ag(
> -	struct xfs_mount	*mp,
>  	struct xfs_perag	*pag,
> +	int			iter_flags,
>  	int			(*execute)(struct xfs_inode *ip, void *args),
>  	void			*args,
> -	int			tag,
> -	int			iter_flags)
> +	int			tag)
>  {
> +	struct xfs_mount	*mp = pag->pag_mount;
>  	uint32_t		first_index;
>  	int			last_error = 0;
>  	int			skipped;
> @@ -932,8 +932,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(mp, pag, execute, args, tag,
> -				iter_flags);
> +		error = xfs_inode_walk_ag(pag, iter_flags, execute, args, tag);
>  		xfs_perag_put(pag);
>  		if (error) {
>  			last_error = error;
>
diff mbox series

Patch

diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c
index baf59087caa5..fbd77467bb4d 100644
--- a/fs/xfs/xfs_icache.c
+++ b/fs/xfs/xfs_icache.c
@@ -797,13 +797,13 @@  xfs_inode_walk_ag_grab(
  */
 STATIC int
 xfs_inode_walk_ag(
-	struct xfs_mount	*mp,
 	struct xfs_perag	*pag,
+	int			iter_flags,
 	int			(*execute)(struct xfs_inode *ip, void *args),
 	void			*args,
-	int			tag,
-	int			iter_flags)
+	int			tag)
 {
+	struct xfs_mount	*mp = pag->pag_mount;
 	uint32_t		first_index;
 	int			last_error = 0;
 	int			skipped;
@@ -932,8 +932,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(mp, pag, execute, args, tag,
-				iter_flags);
+		error = xfs_inode_walk_ag(pag, iter_flags, execute, args, tag);
 		xfs_perag_put(pag);
 		if (error) {
 			last_error = error;