All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 05/10] xfs: turn ag header initialisation into a table driven operation
Date: Sat, 12 May 2018 12:03:31 +1000	[thread overview]
Message-ID: <20180512020331.GZ10363@dastard> (raw)
In-Reply-To: <20180512005535.GR11261@magnolia>

On Fri, May 11, 2018 at 05:55:35PM -0700, Darrick J. Wong wrote:
> On Sat, May 12, 2018 at 08:51:02AM +1000, Dave Chinner wrote:
> > From: Dave Chinner <dchinner@redhat.com>
> > 
> > There's still more cookie cutter code in setting up each AG header.
> > Separate all the variables into a simple structure and iterate a
> > table of header definitions to initialise everything.
> > 
> > Signed-Off-By: Dave Chinner <dchinner@redhat.com>
> > Reviewed-by: Brian Foster <bfoster@redhat.com>
> > ---
> >  fs/xfs/xfs_fsops.c | 158 +++++++++++++++++++--------------------------
> >  1 file changed, 66 insertions(+), 92 deletions(-)
> > 
> > diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
> > index 4dbb7b41aeca..263f9b5da991 100644
> > --- a/fs/xfs/xfs_fsops.c
> > +++ b/fs/xfs/xfs_fsops.c
> > @@ -283,12 +283,13 @@ xfs_agiblock_init(
> >  		agi->agi_unlinked[bucket] = cpu_to_be32(NULLAGINO);
> >  }
> >  
> > +typedef void (*aghdr_init_work_f)(struct xfs_mount *mp, struct xfs_buf *bp,
> > +				  struct aghdr_init_data *id);
> >  static int
> >  xfs_growfs_init_aghdr(
> >  	struct xfs_mount	*mp,
> >  	struct aghdr_init_data	*id,
> > -	void			(*work)(struct xfs_mount *, struct xfs_buf *,
> > -					struct aghdr_init_data *),
> > +	aghdr_init_work_f	work,
> >  	const struct xfs_buf_ops *ops)
> >  
> >  {
> > @@ -305,6 +306,16 @@ xfs_growfs_init_aghdr(
> >  	return 0;
> >  }
> >  
> > +struct xfs_aghdr_grow_data {
> > +	xfs_daddr_t		daddr;
> > +	size_t			numblks;
> > +	const struct xfs_buf_ops *ops;
> > +	aghdr_init_work_f	work;
> > +	xfs_btnum_t		type;
> > +	int			numrecs;
> > +	bool			need_init;
> > +};
> > +
> >  /*
> >   * Write new AG headers to disk. Non-transactional, but written
> >   * synchronously so they are completed prior to the growfs transaction
> > @@ -316,104 +327,67 @@ xfs_grow_ag_headers(
> >  	struct aghdr_init_data	*id)
> >  
> >  {
> > +	struct xfs_aghdr_grow_data aghdr_data[] = {
> > +		/* AGF */
> > +		{ XFS_AG_DADDR(mp, id->agno, XFS_AGF_DADDR(mp)),
> > +		  XFS_FSS_TO_BB(mp, 1), &xfs_agf_buf_ops,
> > +		  &xfs_agfblock_init, 0, 0, true },
> 
> Any chance I could get you to convert these to something associative
> and easier to check? e.g.
> 
> 	/* AGF */
> 	{
> 		.daddr		= XFS_AG_DADDR(mp, id->agno, XFS_AGF_DADDR(mp)),
> 		.numblks	= XFS_FSS_TO_BB(mp, 1),
> 		.ops		= &xfs_agf_buf_ops,
> 		.work		= &xfs_agfblock_init,
> 		.type		= 0,
> 		.numrecs	= 0,
> 		.need_init	= true,
> 	},

I can, if you don't care it will take 100 lines of code instead of
30.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2018-05-12  2:03 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-11 22:50 [PATCH v2] xfs: refactor and tablise growfs Dave Chinner
2018-05-11 22:50 ` [PATCH 01/10] xfs: one-shot cached buffers Dave Chinner
2018-05-12  0:24   ` Darrick J. Wong
2018-05-12  2:06     ` Dave Chinner
2018-05-12  2:08       ` Darrick J. Wong
2018-05-11 22:50 ` [PATCH 02/10] xfs: factor out AG header initialisation from growfs core Dave Chinner
2018-05-12  0:36   ` Darrick J. Wong
2018-05-11 22:51 ` [PATCH 03/10] xfs: convert growfs AG header init to use buffer lists Dave Chinner
2018-05-12  0:39   ` Darrick J. Wong
2018-05-11 22:51 ` [PATCH 04/10] xfs: factor ag btree root block initialisation Dave Chinner
2018-05-12  0:48   ` Darrick J. Wong
2018-05-12  2:01     ` Dave Chinner
2018-05-11 22:51 ` [PATCH 05/10] xfs: turn ag header initialisation into a table driven operation Dave Chinner
2018-05-12  0:55   ` Darrick J. Wong
2018-05-12  2:03     ` Dave Chinner [this message]
2018-05-12  2:05       ` Darrick J. Wong
2018-05-11 22:51 ` [PATCH 06/10] xfs: make imaxpct changes in growfs separate Dave Chinner
2018-05-12  0:57   ` Darrick J. Wong
2018-05-11 22:51 ` [PATCH 07/10] xfs: separate secondary sb update in growfs Dave Chinner
2018-05-12  1:20   ` Darrick J. Wong
2018-05-11 22:51 ` [PATCH 08/10] xfs: rework secondary superblock updates " Dave Chinner
2018-05-12  1:47   ` Darrick J. Wong
2018-05-11 22:51 ` [PATCH 09/10] xfs: move growfs core to libxfs Dave Chinner
2018-05-12  1:48   ` Darrick J. Wong
2018-05-11 22:51 ` [PATCH 10/10] xfs: factor the ag length extension code into libxfs Dave Chinner
2018-05-12  1:48   ` Darrick J. Wong
2018-05-14  4:18 [PATCH 0/10 v3] xfs: refactor and tablise growfs Dave Chinner
2018-05-14  4:18 ` [PATCH 05/10] xfs: turn ag header initialisation into a table driven operation Dave Chinner
2018-05-14 19:27   ` 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=20180512020331.GZ10363@dastard \
    --to=david@fromorbit.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 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.