public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 01/14] xfs: create iterator error codes
Date: Thu, 13 Jun 2019 12:24:26 -0400	[thread overview]
Message-ID: <20190613162423.GA21773@bfoster> (raw)
In-Reply-To: <156032205794.3774243.2000474980369140298.stgit@magnolia>

On Tue, Jun 11, 2019 at 11:47:37PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Currently, xfs doesn't have generic error codes defined for "stop
> iterating"; we just reuse the XFS_BTREE_QUERY_* return values.  This
> looks a little weird if we're not actually iterating a btree index.
> Before we start adding more iterators, we should create general
> XFS_ITER_{CONTINUE,ABORT} return values and define the XFS_BTREE_QUERY_*
> ones from that.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---

Have you given any thought to just replacing
XFS_BTREE_QUERY_RANGE_[ABORT|CONTINUE] with the generic ITER variants
and using the latter wherever applicable?

This patch looks fine either way:

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

>  fs/xfs/libxfs/xfs_alloc.c  |    2 +-
>  fs/xfs/libxfs/xfs_btree.h  |    4 ++--
>  fs/xfs/libxfs/xfs_shared.h |    6 ++++++
>  fs/xfs/scrub/agheader.c    |    4 ++--
>  fs/xfs/scrub/repair.c      |    4 ++--
>  fs/xfs/xfs_dquot.c         |    2 +-
>  6 files changed, 14 insertions(+), 8 deletions(-)
> 
> 
> diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c
> index a9ff3cf82cce..b9eb3a8aeaf9 100644
> --- a/fs/xfs/libxfs/xfs_alloc.c
> +++ b/fs/xfs/libxfs/xfs_alloc.c
> @@ -3146,7 +3146,7 @@ xfs_alloc_has_record(
>  
>  /*
>   * Walk all the blocks in the AGFL.  The @walk_fn can return any negative
> - * error code or XFS_BTREE_QUERY_RANGE_ABORT.
> + * error code or XFS_ITER_*.
>   */
>  int
>  xfs_agfl_walk(
> diff --git a/fs/xfs/libxfs/xfs_btree.h b/fs/xfs/libxfs/xfs_btree.h
> index e3b3e9dce5da..94530766dd30 100644
> --- a/fs/xfs/libxfs/xfs_btree.h
> +++ b/fs/xfs/libxfs/xfs_btree.h
> @@ -469,8 +469,8 @@ uint xfs_btree_compute_maxlevels(uint *limits, unsigned long len);
>  unsigned long long xfs_btree_calc_size(uint *limits, unsigned long long len);
>  
>  /* return codes */
> -#define XFS_BTREE_QUERY_RANGE_CONTINUE	0	/* keep iterating */
> -#define XFS_BTREE_QUERY_RANGE_ABORT	1	/* stop iterating */
> +#define XFS_BTREE_QUERY_RANGE_CONTINUE	(XFS_ITER_CONTINUE) /* keep iterating */
> +#define XFS_BTREE_QUERY_RANGE_ABORT	(XFS_ITER_ABORT)    /* stop iterating */
>  typedef int (*xfs_btree_query_range_fn)(struct xfs_btree_cur *cur,
>  		union xfs_btree_rec *rec, void *priv);
>  
> diff --git a/fs/xfs/libxfs/xfs_shared.h b/fs/xfs/libxfs/xfs_shared.h
> index 4e909791aeac..fa788139dfe3 100644
> --- a/fs/xfs/libxfs/xfs_shared.h
> +++ b/fs/xfs/libxfs/xfs_shared.h
> @@ -136,4 +136,10 @@ void xfs_symlink_local_to_remote(struct xfs_trans *tp, struct xfs_buf *bp,
>  				 struct xfs_inode *ip, struct xfs_ifork *ifp);
>  xfs_failaddr_t xfs_symlink_shortform_verify(struct xfs_inode *ip);
>  
> +/* Keep iterating the data structure. */
> +#define XFS_ITER_CONTINUE	(0)
> +
> +/* Stop iterating the data structure. */
> +#define XFS_ITER_ABORT		(1)
> +
>  #endif /* __XFS_SHARED_H__ */
> diff --git a/fs/xfs/scrub/agheader.c b/fs/xfs/scrub/agheader.c
> index adaeabdefdd3..1d5361f9ebfc 100644
> --- a/fs/xfs/scrub/agheader.c
> +++ b/fs/xfs/scrub/agheader.c
> @@ -646,7 +646,7 @@ xchk_agfl_block(
>  	xchk_agfl_block_xref(sc, agbno);
>  
>  	if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
> -		return XFS_BTREE_QUERY_RANGE_ABORT;
> +		return XFS_ITER_ABORT;
>  
>  	return 0;
>  }
> @@ -737,7 +737,7 @@ xchk_agfl(
>  	/* Check the blocks in the AGFL. */
>  	error = xfs_agfl_walk(sc->mp, XFS_BUF_TO_AGF(sc->sa.agf_bp),
>  			sc->sa.agfl_bp, xchk_agfl_block, &sai);
> -	if (error == XFS_BTREE_QUERY_RANGE_ABORT) {
> +	if (error == XFS_ITER_ABORT) {
>  		error = 0;
>  		goto out_free;
>  	}
> diff --git a/fs/xfs/scrub/repair.c b/fs/xfs/scrub/repair.c
> index eb358f0f5e0a..e2a352c1bad7 100644
> --- a/fs/xfs/scrub/repair.c
> +++ b/fs/xfs/scrub/repair.c
> @@ -672,7 +672,7 @@ xrep_findroot_agfl_walk(
>  {
>  	xfs_agblock_t		*agbno = priv;
>  
> -	return (*agbno == bno) ? XFS_BTREE_QUERY_RANGE_ABORT : 0;
> +	return (*agbno == bno) ? XFS_ITER_ABORT : 0;
>  }
>  
>  /* Does this block match the btree information passed in? */
> @@ -702,7 +702,7 @@ xrep_findroot_block(
>  	if (owner == XFS_RMAP_OWN_AG) {
>  		error = xfs_agfl_walk(mp, ri->agf, ri->agfl_bp,
>  				xrep_findroot_agfl_walk, &agbno);
> -		if (error == XFS_BTREE_QUERY_RANGE_ABORT)
> +		if (error == XFS_ITER_ABORT)
>  			return 0;
>  		if (error)
>  			return error;
> diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c
> index a1af984e4913..8674551c5e98 100644
> --- a/fs/xfs/xfs_dquot.c
> +++ b/fs/xfs/xfs_dquot.c
> @@ -1243,7 +1243,7 @@ xfs_qm_exit(void)
>  /*
>   * Iterate every dquot of a particular type.  The caller must ensure that the
>   * particular quota type is active.  iter_fn can return negative error codes,
> - * or XFS_BTREE_QUERY_RANGE_ABORT to indicate that it wants to stop iterating.
> + * or XFS_ITER_ABORT to indicate that it wants to stop iterating.
>   */
>  int
>  xfs_qm_dqiterate(
> 

  reply	other threads:[~2019-06-13 16:24 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-12  6:47 [PATCH v5 00/14] xfs: refactor and improve inode iteration Darrick J. Wong
2019-06-12  6:47 ` [PATCH 01/14] xfs: create iterator error codes Darrick J. Wong
2019-06-13 16:24   ` Brian Foster [this message]
2019-06-12  6:47 ` [PATCH 02/14] xfs: create simplified inode walk function Darrick J. Wong
2019-06-13 16:27   ` Brian Foster
2019-06-13 18:06     ` Darrick J. Wong
2019-06-13 18:07       ` Darrick J. Wong
2019-06-12  6:47 ` [PATCH 03/14] xfs: convert quotacheck to use the new iwalk functions Darrick J. Wong
2019-06-12  6:47 ` [PATCH 04/14] xfs: bulkstat should copy lastip whenever userspace supplies one Darrick J. Wong
2019-06-12  6:48 ` [PATCH 05/14] xfs: remove unnecessary includes of xfs_itable.h Darrick J. Wong
2019-06-13 16:27   ` Brian Foster
2019-06-12  6:48 ` [PATCH 06/14] xfs: convert bulkstat to new iwalk infrastructure Darrick J. Wong
2019-06-13 16:31   ` Brian Foster
2019-06-13 18:12     ` Darrick J. Wong
2019-06-13 23:03       ` Darrick J. Wong
2019-06-14 11:10         ` Brian Foster
2019-06-14 16:45           ` Darrick J. Wong
2019-07-02 11:42             ` Brian Foster
2019-07-02 15:33               ` Darrick J. Wong
2019-06-12  6:48 ` [PATCH 07/14] xfs: move bulkstat ichunk helpers to iwalk code Darrick J. Wong
2019-06-12  6:48 ` [PATCH 08/14] xfs: change xfs_iwalk_grab_ichunk to use startino, not lastino Darrick J. Wong
2019-06-12  6:48 ` [PATCH 09/14] xfs: clean up long conditionals in xfs_iwalk_ichunk_ra Darrick J. Wong
2019-06-12  6:48 ` [PATCH 10/14] xfs: refactor xfs_iwalk_grab_ichunk Darrick J. Wong
2019-06-14 14:04   ` Brian Foster
2019-06-12  6:48 ` [PATCH 11/14] xfs: refactor iwalk code to handle walking inobt records Darrick J. Wong
2019-06-14 14:04   ` Brian Foster
2019-06-12  6:48 ` [PATCH 12/14] xfs: refactor INUMBERS to use iwalk functions Darrick J. Wong
2019-06-14 14:05   ` Brian Foster
2019-06-12  6:48 ` [PATCH 13/14] xfs: multithreaded iwalk implementation Darrick J. Wong
2019-06-14 14:06   ` Brian Foster
2019-06-18 18:17     ` Darrick J. Wong
2019-06-12  6:49 ` [PATCH 14/14] xfs: poll waiting for quotacheck Darrick J. Wong
2019-06-14 14:07   ` Brian Foster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190613162423.GA21773@bfoster \
    --to=bfoster@redhat.com \
    --cc=darrick.wong@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox