All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 06/23 V2] xfs: convert xfs_iwalk to use perag references
Date: Wed, 2 Jun 2021 10:34:45 +1000	[thread overview]
Message-ID: <20210602003445.GI664593@dread.disaster.area> (raw)
In-Reply-To: <20210601233216.GF26380@locust>

On Tue, Jun 01, 2021 at 04:32:16PM -0700, Darrick J. Wong wrote:
> On Wed, Jun 02, 2021 at 08:00:54AM +1000, Dave Chinner wrote:
> > From: Dave Chinner <dchinner@redhat.com>
> > 
> > Rather than manually walking the ags and passing agnunbers around,
> > pass the perag for the AG we are currently working on around in the
> > iwalk structure.
> > 
> > Signed-off-by: Dave Chinner <dchinner@redhat.com>
> > Reviewed-by: Brian Foster <bfoster@redhat.com>
> > ---
> > V2: convert next_agno -> agno in perag walk macros
> > 
> >  fs/xfs/libxfs/xfs_ag.h | 20 +++++++-----
> >  fs/xfs/xfs_iwalk.c     | 86 +++++++++++++++++++++++++++++++-------------------
> >  2 files changed, 66 insertions(+), 40 deletions(-)
> > 
> > diff --git a/fs/xfs/libxfs/xfs_ag.h b/fs/xfs/libxfs/xfs_ag.h
> > index 33783120263c..2e02ec3693c5 100644
> > --- a/fs/xfs/libxfs/xfs_ag.h
> > +++ b/fs/xfs/libxfs/xfs_ag.h
> > @@ -117,19 +117,23 @@ void	xfs_perag_put(struct xfs_perag *pag);
> >  /*
> >   * Perag iteration APIs
> >   */
> > -#define for_each_perag(mp, next_agno, pag) \
> > -	for ((next_agno) = 0, (pag) = xfs_perag_get((mp), 0); \
> > +#define for_each_perag_from(mp, agno, pag) \
> > +	for ((pag) = xfs_perag_get((mp), (agno)); \
> 
> Er... I guess I wasn't clear enough.  I was ok with the "next_agno" name
> for for_each_perag_from to reinforce the idea that the caller is
> required to initialize the variable before using the macro.
> 
> It's the other variants (for_each_perag and for_each_perag_tag) where
> the macro initializes @agno so it's not necessary for the caller to have
> provided any value at all.
> 
> IOWS,
> 
> #define for_each_perag_from(mp, next_agno, pag) \
> 	for ((pag) = xfs_perag_get((mp), (next_agno)); \
> 		(pag) != NULL; \
> 		(next_agno) = (pag)->pag_agno + 1, \
> 		xfs_perag_put(pag), \
> 		(pag) = xfs_perag_get((mp), (next_agno)))
> 
> #define for_each_perag(mp, agno, pag) \
> 	(agno) = 0; \
> 	for_each_perag_from((mp), (agno), (pag))
> 
> #define for_each_perag_tag(mp, agno, pag, tag) \
> 	for ((agno) = 0, (pag) = xfs_perag_get_tag((mp), 0, (tag)); \
> 		(pag) != NULL; \
> 		(agno) = (pag)->pag_agno + 1, \
> 		xfs_perag_put(pag), \
> 		(pag) = xfs_perag_get_tag((mp), (agno), (tag)))

Ok, let me go change that back...

-Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2021-06-02  0:34 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-19  1:20 [PATCH 00/23] xfs: initial agnumber -> perag conversions for shrink Dave Chinner
2021-05-19  1:20 ` [PATCH 01/23] xfs: move xfs_perag_get/put to xfs_ag.[ch] Dave Chinner
2021-05-19  1:20 ` [PATCH 02/23] xfs: prepare for moving perag definitions and support to libxfs Dave Chinner
2021-05-26 12:33   ` Brian Foster
2021-05-27 22:02   ` Darrick J. Wong
2021-05-19  1:20 ` [PATCH 03/23] xfs: move perag structure and setup to libxfs/xfs_ag.[ch] Dave Chinner
2021-05-26 12:33   ` Brian Foster
2021-05-27 22:07   ` Darrick J. Wong
2021-05-19  1:20 ` [PATCH 04/23] xfs: make for_each_perag... a first class citizen Dave Chinner
2021-05-26 12:33   ` Brian Foster
2021-05-27 22:10   ` Darrick J. Wong
2021-05-19  1:20 ` [PATCH 05/23] xfs: convert raw ag walks to use for_each_perag Dave Chinner
2021-05-26 12:33   ` Brian Foster
2021-05-27 22:12   ` Darrick J. Wong
2021-05-19  1:20 ` [PATCH 06/23] xfs: convert xfs_iwalk to use perag references Dave Chinner
2021-05-27 22:16   ` Darrick J. Wong
2021-06-01 22:00     ` [PATCH 06/23 V2] " Dave Chinner
2021-06-01 23:32       ` Darrick J. Wong
2021-06-02  0:34         ` Dave Chinner [this message]
2021-05-19  1:20 ` [PATCH 07/23] xfs: convert secondary superblock walk to use perags Dave Chinner
2021-05-19  1:20 ` [PATCH 08/23] xfs: pass perags through to the busy extent code Dave Chinner
2021-05-19  1:20 ` [PATCH 09/23] xfs: push perags through the ag reservation callouts Dave Chinner
2021-05-26 12:34   ` Brian Foster
2021-05-19  1:20 ` [PATCH 10/23] xfs: pass perags around in fsmap data dev functions Dave Chinner
2021-05-27 22:19   ` Darrick J. Wong
2021-05-19  1:20 ` [PATCH 11/23] xfs: add a perag to the btree cursor Dave Chinner
2021-05-26 12:34   ` Brian Foster
2021-05-19  1:20 ` [PATCH 12/23] xfs: convert rmap btree cursor to using a perag Dave Chinner
2021-05-19  1:20 ` [PATCH 13/23] xfs: convert refcount btree cursor to use perags Dave Chinner
2021-05-27 22:22   ` Darrick J. Wong
2021-05-19  1:20 ` [PATCH 14/23] xfs: convert allocbt cursors " Dave Chinner
2021-05-19  1:20 ` [PATCH 15/23] xfs: use perag for ialloc btree cursors Dave Chinner
2021-05-19  1:20 ` [PATCH 16/23] xfs: remove agno from btree cursor Dave Chinner
2021-05-19  1:20 ` [PATCH 17/23] xfs: simplify xfs_dialloc_select_ag() return values Dave Chinner
2021-05-19  1:20 ` [PATCH 18/23] xfs: collapse AG selection for inode allocation Dave Chinner
2021-05-27 11:19   ` Brian Foster
2021-06-01 22:40     ` [PATCH 18/23 V2] " Dave Chinner
2021-06-01 23:27       ` Darrick J. Wong
2021-05-27 22:33   ` [PATCH 18/23] " Darrick J. Wong
2021-05-19  1:20 ` [PATCH 19/23] xfs: get rid of xfs_dir_ialloc() Dave Chinner
2021-05-19  1:20 ` [PATCH 20/23] xfs: inode allocation can use a single perag instance Dave Chinner
2021-05-19  1:21 ` [PATCH 21/23] xfs: clean up and simplify xfs_dialloc() Dave Chinner
2021-05-27 11:20   ` Brian Foster
2021-05-27 22:39   ` Darrick J. Wong
2021-05-19  1:21 ` [PATCH 22/23] xfs: use perag through unlink processing Dave Chinner
2021-05-27 11:20   ` Brian Foster
2021-05-19  1:21 ` [PATCH 23/23] xfs: remove xfs_perag_t Dave Chinner
2021-05-27 11:20   ` Brian Foster
2021-05-27 22:06   ` Darrick J. Wong

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=20210602003445.GI664593@dread.disaster.area \
    --to=david@fromorbit.com \
    --cc=djwong@kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.