public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Alli <allison.henderson@oracle.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 5/8] xfs: factor and move some code in xfs_log_cil.c
Date: Tue, 12 Apr 2022 20:25:32 +1000	[thread overview]
Message-ID: <20220412102532.GI1544202@dread.disaster.area> (raw)
In-Reply-To: <b9047c05f26e02136f66ad644a3bb42a3e2b90b2.camel@oracle.com>

On Sun, Apr 10, 2022 at 10:24:21PM -0700, Alli wrote:
> On Tue, 2022-03-15 at 09:06 +1100, Dave Chinner wrote:
> > From: Dave Chinner <dchinner@redhat.com>
> > 
> > In preparation for adding support for intent item whiteouts.
> > 
> > Signed-off-by: Dave Chinner <dchinner@redhat.com>
> > ---
> >  fs/xfs/xfs_log_cil.c | 119 ++++++++++++++++++++++++-----------------
> > --
> >  1 file changed, 67 insertions(+), 52 deletions(-)
> > 
> > diff --git a/fs/xfs/xfs_log_cil.c b/fs/xfs/xfs_log_cil.c
> > index 5179436b6603..dda71f1a25c5 100644
> > --- a/fs/xfs/xfs_log_cil.c
> > +++ b/fs/xfs/xfs_log_cil.c
> > @@ -47,6 +47,38 @@ xlog_cil_ticket_alloc(
> >  	return tic;
> >  }
> >  
> > +/*
> > + * Check if the current log item was first committed in this
> > sequence.
> > + * We can't rely on just the log item being in the CIL, we have to
> > check
> > + * the recorded commit sequence number.
> > + *
> > + * Note: for this to be used in a non-racy manner, it has to be
> > called with
> > + * CIL flushing locked out. As a result, it should only be used
> > during the
> > + * transaction commit process when deciding what to format into the
> > item.
> > + */
> > +static bool
> > +xlog_item_in_current_chkpt(
> > +	struct xfs_cil		*cil,
> > +	struct xfs_log_item	*lip)
> > +{
> > +	if (list_empty(&lip->li_cil))
> > +		return false;
> > +
> > +	/*
> > +	 * li_seq is written on the first commit of a log item to
> > record the
> > +	 * first checkpoint it is written to. Hence if it is different
> > to the
> > +	 * current sequence, we're in a new checkpoint.
> > +	 */
> > +	return lip->li_seq == READ_ONCE(cil->xc_current_sequence);
> > +}
> > +
> > +bool
> > +xfs_log_item_in_current_chkpt(
> > +	struct xfs_log_item *lip)
> > +{
> > +	return xlog_item_in_current_chkpt(lip->li_mountp->m_log-
> > >l_cilp, lip);
> 
> I think this turns into "lip->li_log->l_mp->m_log->l_cilp" in the new
> code base

Should just be lip->li_log->l_cilp.

> 
> > +}
> > +
> >  /*
> >   * Unavoidable forward declaration - xlog_cil_push_work() calls
> >   * xlog_cil_ctx_alloc() itself.
> > @@ -924,6 +956,40 @@ xlog_cil_build_trans_hdr(
> >  	tic->t_curr_res -= lvhdr->lv_bytes;
> >  }
> >  
> > +/*
> > + * Pull all the log vectors off the items in the CIL, and remove the
> > items from
> > + * the CIL. We don't need the CIL lock here because it's only needed
> > on the
> > + * transaction commit side which is currently locked out by the
> > flush lock.
> > + */
> > +static void
> > +xlog_cil_build_lv_chain(
> > +	struct xfs_cil		*cil,
> > +	struct xfs_cil_ctx	*ctx,
> > +	uint32_t		*num_iovecs,
> > +	uint32_t		*num_bytes)
> > +{
> > +	struct xfs_log_vec	*lv = NULL;
> > +
> > +	while (!list_empty(&cil->xc_cil)) {
> > +		struct xfs_log_item	*item;
> > +
> > +		item = list_first_entry(&cil->xc_cil,
> > +					struct xfs_log_item, li_cil);
> > +		list_del_init(&item->li_cil);
> > +		if (!ctx->lv_chain)
> > +			ctx->lv_chain = item->li_lv;
> > +		else
> > +			lv->lv_next = item->li_lv;
> > +		lv = item->li_lv;
> > +		item->li_lv = NULL;
> > +		*num_iovecs += lv->lv_niovecs;
> > 
> 
> This part below does not appear in the new rebase, so this would go
> away in the hoisted helper
> 
> > +
> > +		/* we don't write ordered log vectors */
> > +		if (lv->lv_buf_len != XFS_LOG_VEC_ORDERED)
> > +			*num_bytes += lv->lv_bytes;
> > +	}
> > +}
> > +
> >  /*
> >   * Push the Committed Item List to the log.
> >   *
> > @@ -946,7 +1012,6 @@ xlog_cil_push_work(
> >  		container_of(work, struct xfs_cil_ctx, push_work);
> >  	struct xfs_cil		*cil = ctx->cil;
> >  	struct xlog		*log = cil->xc_log;
> > -	struct xfs_log_vec	*lv;
> >  	struct xfs_cil_ctx	*new_ctx;
> >  	int			num_iovecs = 0;
> 
> For me, I had to add the new num_bytes variable here:
> 	int			num_iovecs, num_bytes;
> 
> I think the new helper does not need the num_bytes parameter in the new
> rebase, so we may be able to just remove num_bytes  entirely.

Right, so this is all stuff that changes in the xlog-write rework
patch series that this was based on. There's a lot of changes
to the CIL push code in that series that this builds on....

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2022-04-12 11:43 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-14 22:06 [PATCH 0/8 v3] xfs: intent whiteouts Dave Chinner
2022-03-14 22:06 ` [PATCH 1/8] xfs: hide log iovec alignment constraints Dave Chinner
2022-04-11  5:23   ` Alli
2022-04-12 10:13     ` Dave Chinner
2022-03-14 22:06 ` [PATCH 2/8] xfs: don't commit the first deferred transaction without intents Dave Chinner
2022-04-11  5:22   ` Alli
2022-04-12 10:21     ` Dave Chinner
2022-03-14 22:06 ` [PATCH 3/8] xfs: add log item flags to indicate intents Dave Chinner
2022-04-11  5:23   ` Alli
2022-03-14 22:06 ` [PATCH 4/8] xfs: tag transactions that contain intent done items Dave Chinner
2022-04-11  5:23   ` Alli
2022-03-14 22:06 ` [PATCH 5/8] xfs: factor and move some code in xfs_log_cil.c Dave Chinner
2022-04-11  5:24   ` Alli
2022-04-12 10:25     ` Dave Chinner [this message]
2022-03-14 22:06 ` [PATCH 6/8] xfs: add log item method to return related intents Dave Chinner
2022-04-11  5:24   ` Alli
2022-03-14 22:06 ` [PATCH 7/8] xfs: whiteouts release intents that are not in the AIL Dave Chinner
2022-04-11  5:27   ` Alli
2022-03-14 22:06 ` [PATCH 8/8] xfs: intent item whiteouts Dave Chinner
2022-04-11  5:22 ` [PATCH 0/8 v3] xfs: intent whiteouts Alli
  -- strict thread matches above, loose matches on Subject: below --
2022-04-27  2:22 [PATCH 0/8 v5] " Dave Chinner
2022-04-27  2:22 ` [PATCH 5/8] xfs: factor and move some code in xfs_log_cil.c Dave Chinner
2022-04-27  3:15   ` Darrick J. Wong
2022-04-27  4:56     ` Dave Chinner
2022-04-28 13:06   ` Christoph Hellwig
2022-04-29  1:56   ` Alli

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=20220412102532.GI1544202@dread.disaster.area \
    --to=david@fromorbit.com \
    --cc=allison.henderson@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