linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 01/21] xfs: refactor log recovery item sorting into a generic dispatch structure
Date: Thu, 30 Apr 2020 11:16:28 -0700	[thread overview]
Message-ID: <20200430181628.GB6742@magnolia> (raw)
In-Reply-To: <20200430150821.GY6742@magnolia>

On Thu, Apr 30, 2020 at 08:08:21AM -0700, Darrick J. Wong wrote:
> On Wed, Apr 29, 2020 at 10:53:09PM -0700, Christoph Hellwig wrote:
> > On Wed, Apr 29, 2020 at 05:47:41PM -0700, Darrick J. Wong wrote:
> > > +extern const struct xlog_recover_item_type xlog_icreate_item_type;
> > > +extern const struct xlog_recover_item_type xlog_buf_item_type;
> > > +extern const struct xlog_recover_item_type xlog_inode_item_type;
> > > +extern const struct xlog_recover_item_type xlog_dquot_item_type;
> > > +extern const struct xlog_recover_item_type xlog_quotaoff_item_type;
> > > +extern const struct xlog_recover_item_type xlog_bmap_intent_item_type;
> > > +extern const struct xlog_recover_item_type xlog_bmap_done_item_type;
> > > +extern const struct xlog_recover_item_type xlog_extfree_intent_item_type;
> > > +extern const struct xlog_recover_item_type xlog_extfree_done_item_type;
> > > +extern const struct xlog_recover_item_type xlog_rmap_intent_item_type;
> > > +extern const struct xlog_recover_item_type xlog_rmap_done_item_type;
> > > +extern const struct xlog_recover_item_type xlog_refcount_intent_item_type;
> > > +extern const struct xlog_recover_item_type xlog_refcount_done_item_type;
> > 
> > I'd prefer if we didn't have to expose these structures, but had a
> > xlog_register_recovery_item helper that just adds them to a list or
> > array.
> 
> I can look into making a register function and do lookups, but that's
> a lot of indirection to save ~15 or so externs.

Ok, so I looked into this, and I don't know of a good way to avoid
exporting 14 *somethings*.  If we require a xlog_register_recovery_item
call to link the item types when the module loads, something has to call
that registration function.  That can be an __init function in each item
recovery source file, but now we have to export all fourteen of those
functions so that we can call them from init_xfs_fs.  Unless you've got
a better suggestion, I don't think this is worth the effort.

--D

> > >  typedef struct xlog_recover_item {
> > >  	struct list_head	ri_list;
> > > -	int			ri_type;
> > >  	int			ri_cnt;	/* count of regions found */
> > >  	int			ri_total;	/* total regions */
> > >  	xfs_log_iovec_t		*ri_buf;	/* ptr to regions buffer */
> > > +	const struct xlog_recover_item_type *ri_type;
> > >  } xlog_recover_item_t;
> > 
> > Btw, killing the xlog_recover_item_t typedef might be a worthwhile prep
> > patch.
> 
> Hrm, ok....
> 
> > > --- a/fs/xfs/xfs_buf_item.c
> > > +++ b/fs/xfs/xfs_buf_item.c
> > > @@ -17,7 +17,6 @@
> > >  #include "xfs_trace.h"
> > >  #include "xfs_log.h"
> > >  
> > > -
> > >  kmem_zone_t	*xfs_buf_item_zone;
> > >  
> > >  static inline struct xfs_buf_log_item *BUF_ITEM(struct xfs_log_item *lip)
> > 
> > Spurious whitespace change in a file not otherwise touched.
> 
> Fixed.
> 
> > >  
> > > @@ -107,3 +109,14 @@ xfs_icreate_log(
> > >  	tp->t_flags |= XFS_TRANS_DIRTY;
> > >  	set_bit(XFS_LI_DIRTY, &icp->ic_item.li_flags);
> > >  }
> > > +
> > > +static enum xlog_recover_reorder
> > > +xlog_icreate_reorder(
> > > +		struct xlog_recover_item *item)
> > > +{
> > > +	return XLOG_REORDER_BUFFER_LIST;
> > > +}
> > 
> > It might be worth to throw in a comment why icreate items got to
> > the buffer list.
> > 
> > > +		return 0;
> > > +#ifdef CONFIG_XFS_QUOTA
> > > +	case XFS_LI_DQUOT:
> > > +		item->ri_type = &xlog_dquot_item_type;
> > > +		return 0;
> > > +	case XFS_LI_QUOTAOFF:
> > > +		item->ri_type = &xlog_quotaoff_item_type;
> > > +		return 0;
> > > +#endif /* CONFIG_XFS_QUOTA */
> > > +	default:
> > > +		return -EFSCORRUPTED;
> > > +	}
> > > +}
> > 
> > Quote recovery support currently is unconditionalẏ  Making it
> > conditional on CONFIG_XFS_QUOTA means a kernel without that config
> > will now fail to recover a file system with quota updates in the log.
> 
> Heh, I hadn't realized that quota recovery always works even if quotas
> are disabled.  Ok, xfs_dquot_recovery.c it is...
> 
> --D

  reply	other threads:[~2020-04-30 18:18 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-30  0:47 [PATCH v2 00/21] xfs: refactor log recovery Darrick J. Wong
2020-04-30  0:47 ` [PATCH 01/21] xfs: refactor log recovery item sorting into a generic dispatch structure Darrick J. Wong
2020-04-30  5:53   ` Christoph Hellwig
2020-04-30 15:08     ` Darrick J. Wong
2020-04-30 18:16       ` Darrick J. Wong [this message]
2020-05-01  8:08         ` Christoph Hellwig
2020-05-01 10:40   ` Chandan Rajendra
2020-04-30  0:47 ` [PATCH 02/21] xfs: refactor log recovery item dispatch for pass2 readhead functions Darrick J. Wong
2020-05-01 12:10   ` Chandan Rajendra
2020-04-30  0:47 ` [PATCH 03/21] xfs: refactor log recovery item dispatch for pass1 commit functions Darrick J. Wong
2020-04-30  0:48 ` [PATCH 04/21] xfs: refactor log recovery buffer item dispatch for pass2 " Darrick J. Wong
2020-05-01 13:43   ` Chandan Rajendra
2020-04-30  0:48 ` [PATCH 05/21] xfs: refactor log recovery inode " Darrick J. Wong
2020-05-01 14:03   ` Chandan Rajendra
2020-04-30  0:48 ` [PATCH 06/21] xfs: refactor log recovery dquot " Darrick J. Wong
2020-05-01 14:14   ` Chandan Rajendra
2020-04-30  0:48 ` [PATCH 07/21] xfs: refactor log recovery icreate " Darrick J. Wong
2020-05-01 14:18   ` Chandan Rajendra
2020-04-30  0:48 ` [PATCH 08/21] xfs: remove log recovery quotaoff " Darrick J. Wong
2020-05-01 15:09   ` Chandan Rajendra
2020-05-01 17:41     ` Darrick J. Wong
2020-04-30  0:48 ` [PATCH 09/21] xfs: refactor log recovery EFI " Darrick J. Wong
2020-05-01 10:28   ` Christoph Hellwig
2020-05-01 17:56     ` Darrick J. Wong
2020-04-30  0:48 ` [PATCH 10/21] xfs: refactor log recovery RUI " Darrick J. Wong
2020-04-30  0:48 ` [PATCH 11/21] xfs: refactor log recovery CUI " Darrick J. Wong
2020-04-30  0:48 ` [PATCH 12/21] xfs: refactor log recovery BUI " Darrick J. Wong
2020-04-30  0:48 ` [PATCH 13/21] xfs: refactor recovered EFI log item playback Darrick J. Wong
2020-05-01 10:19   ` Christoph Hellwig
2020-05-01 17:58     ` Darrick J. Wong
2020-04-30  0:49 ` [PATCH 14/21] xfs: refactor recovered RUI " Darrick J. Wong
2020-04-30  0:49 ` [PATCH 15/21] xfs: refactor recovered CUI " Darrick J. Wong
2020-04-30  0:49 ` [PATCH 16/21] xfs: refactor recovered BUI " Darrick J. Wong
2020-04-30  0:49 ` [PATCH 17/21] xfs: refactor releasing finished intents during log recovery Darrick J. Wong
2020-04-30  0:49 ` [PATCH 18/21] xfs: refactor adding recovered intent items to the log Darrick J. Wong
2020-04-30  0:49 ` [PATCH 19/21] xfs: refactor intent item RECOVERED flag into the log item Darrick J. Wong
2020-04-30  0:49 ` [PATCH 20/21] xfs: refactor intent item iop_recover calls Darrick J. Wong
2020-04-30  0:49 ` [PATCH 21/21] xfs: remove unnecessary includes from xfs_log_recover.c Darrick J. Wong
2020-05-01 10:15 ` [PATCH v2 00/21] xfs: refactor log recovery Christoph Hellwig
2020-05-01 16:53   ` Darrick J. Wong
2020-05-01 17:03     ` Christoph Hellwig

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=20200430181628.GB6742@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=hch@infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).