public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 06/20] xfs: don't use xfs_trans_free_items in the commit path
Date: Fri, 17 May 2019 10:08:53 -0400	[thread overview]
Message-ID: <20190517140853.GF7888@bfoster> (raw)
In-Reply-To: <20190517073119.30178-7-hch@lst.de>

On Fri, May 17, 2019 at 09:31:05AM +0200, Christoph Hellwig wrote:
> While commiting items looks very similar to freeing them on error it is
> a different operation, and they will diverge a bit soon.
> 
> Split out the commit case from xfs_trans_free_items, inline it into
> xfs_log_commit_cil and give it a separate trace point.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---

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

>  fs/xfs/xfs_log_cil.c    | 13 ++++++++++---
>  fs/xfs/xfs_trace.h      |  1 +
>  fs/xfs/xfs_trans.c      | 10 +++-------
>  fs/xfs/xfs_trans_priv.h |  2 --
>  4 files changed, 14 insertions(+), 12 deletions(-)
> 
> diff --git a/fs/xfs/xfs_log_cil.c b/fs/xfs/xfs_log_cil.c
> index 49f37905c7a7..c856bfce5bf2 100644
> --- a/fs/xfs/xfs_log_cil.c
> +++ b/fs/xfs/xfs_log_cil.c
> @@ -985,6 +985,7 @@ xfs_log_commit_cil(
>  {
>  	struct xlog		*log = mp->m_log;
>  	struct xfs_cil		*cil = log->l_cilp;
> +	struct xfs_log_item	*lip, *next;
>  	xfs_lsn_t		xc_commit_lsn;
>  
>  	/*
> @@ -1009,7 +1010,7 @@ xfs_log_commit_cil(
>  
>  	/*
>  	 * Once all the items of the transaction have been copied to the CIL,
> -	 * the items can be unlocked and freed.
> +	 * the items can be unlocked and possibly freed.
>  	 *
>  	 * This needs to be done before we drop the CIL context lock because we
>  	 * have to update state in the log items and unlock them before they go
> @@ -1018,8 +1019,14 @@ xfs_log_commit_cil(
>  	 * the log items. This affects (at least) processing of stale buffers,
>  	 * inodes and EFIs.
>  	 */
> -	xfs_trans_free_items(tp, xc_commit_lsn, false);
> -
> +	trace_xfs_trans_commit_items(tp, _RET_IP_);
> +	list_for_each_entry_safe(lip, next, &tp->t_items, li_trans) {
> +		xfs_trans_del_item(lip);
> +		if (lip->li_ops->iop_committing)
> +			lip->li_ops->iop_committing(lip, xc_commit_lsn);
> +		if (lip->li_ops->iop_unlock)
> +			lip->li_ops->iop_unlock(lip);
> +	}
>  	xlog_cil_push_background(log);
>  
>  	up_read(&cil->xc_ctx_lock);
> diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h
> index 2464ea351f83..195a9cdb954e 100644
> --- a/fs/xfs/xfs_trace.h
> +++ b/fs/xfs/xfs_trace.h
> @@ -3360,6 +3360,7 @@ DEFINE_TRANS_EVENT(xfs_trans_dup);
>  DEFINE_TRANS_EVENT(xfs_trans_free);
>  DEFINE_TRANS_EVENT(xfs_trans_roll);
>  DEFINE_TRANS_EVENT(xfs_trans_add_item);
> +DEFINE_TRANS_EVENT(xfs_trans_commit_items);
>  DEFINE_TRANS_EVENT(xfs_trans_free_items);
>  
>  TRACE_EVENT(xfs_iunlink_update_bucket,
> diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
> index ed7547b9f66b..4ed5d032b26f 100644
> --- a/fs/xfs/xfs_trans.c
> +++ b/fs/xfs/xfs_trans.c
> @@ -767,10 +767,9 @@ xfs_trans_del_item(
>  }
>  
>  /* Detach and unlock all of the items in a transaction */
> -void
> +static void
>  xfs_trans_free_items(
>  	struct xfs_trans	*tp,
> -	xfs_lsn_t		commit_lsn,
>  	bool			abort)
>  {
>  	struct xfs_log_item	*lip, *next;
> @@ -779,9 +778,6 @@ xfs_trans_free_items(
>  
>  	list_for_each_entry_safe(lip, next, &tp->t_items, li_trans) {
>  		xfs_trans_del_item(lip);
> -		if (commit_lsn != NULLCOMMITLSN &&
> -		    lip->li_ops->iop_committing)
> -			lip->li_ops->iop_committing(lip, commit_lsn);
>  		if (abort)
>  			set_bit(XFS_LI_ABORTED, &lip->li_flags);
>  
> @@ -1007,7 +1003,7 @@ __xfs_trans_commit(
>  		tp->t_ticket = NULL;
>  	}
>  	current_restore_flags_nested(&tp->t_pflags, PF_MEMALLOC_NOFS);
> -	xfs_trans_free_items(tp, NULLCOMMITLSN, !!error);
> +	xfs_trans_free_items(tp, !!error);
>  	xfs_trans_free(tp);
>  
>  	XFS_STATS_INC(mp, xs_trans_empty);
> @@ -1069,7 +1065,7 @@ xfs_trans_cancel(
>  	/* mark this thread as no longer being in a transaction */
>  	current_restore_flags_nested(&tp->t_pflags, PF_MEMALLOC_NOFS);
>  
> -	xfs_trans_free_items(tp, NULLCOMMITLSN, dirty);
> +	xfs_trans_free_items(tp, dirty);
>  	xfs_trans_free(tp);
>  }
>  
> diff --git a/fs/xfs/xfs_trans_priv.h b/fs/xfs/xfs_trans_priv.h
> index 091eae9f4e74..bef1ebf933ed 100644
> --- a/fs/xfs/xfs_trans_priv.h
> +++ b/fs/xfs/xfs_trans_priv.h
> @@ -16,8 +16,6 @@ struct xfs_log_vec;
>  void	xfs_trans_init(struct xfs_mount *);
>  void	xfs_trans_add_item(struct xfs_trans *, struct xfs_log_item *);
>  void	xfs_trans_del_item(struct xfs_log_item *);
> -void	xfs_trans_free_items(struct xfs_trans *tp, xfs_lsn_t commit_lsn,
> -				bool abort);
>  void	xfs_trans_unreserve_and_mod_sb(struct xfs_trans *tp);
>  
>  void	xfs_trans_committed_bulk(struct xfs_ail *ailp, struct xfs_log_vec *lv,
> -- 
> 2.20.1
> 

  reply	other threads:[~2019-05-17 14:08 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-17  7:30 misc log item related cleanups Christoph Hellwig
2019-05-17  7:31 ` [PATCH 01/20] xfs: fix a trivial comment typo in the xfs_trans_committed_bulk Christoph Hellwig
2019-05-17 14:04   ` Brian Foster
2019-05-20 22:08   ` Darrick J. Wong
2019-05-17  7:31 ` [PATCH 02/20] xfs: stop using XFS_LI_ABORTED as a parameter flag Christoph Hellwig
2019-05-17 14:04   ` Brian Foster
2019-05-20  6:03     ` Christoph Hellwig
2019-05-17 14:10   ` Eric Sandeen
2019-05-20  6:05     ` Christoph Hellwig
2019-05-20 22:08   ` Darrick J. Wong
2019-06-11  8:46     ` Christoph Hellwig
2019-05-17  7:31 ` [PATCH 03/20] xfs: don't require log items to implement optional methods Christoph Hellwig
2019-05-17 14:06   ` Brian Foster
2019-05-20  6:06     ` Christoph Hellwig
2019-05-17  7:31 ` [PATCH 04/20] xfs: remove the dummy iop_push implementation for inode creation items Christoph Hellwig
2019-05-17 14:07   ` Brian Foster
2019-05-17  7:31 ` [PATCH 05/20] xfs: remove the iop_push implementation for quota off items Christoph Hellwig
2019-05-17 14:08   ` Brian Foster
2019-05-20  6:09     ` Christoph Hellwig
2019-05-17  7:31 ` [PATCH 06/20] xfs: don't use xfs_trans_free_items in the commit path Christoph Hellwig
2019-05-17 14:08   ` Brian Foster [this message]
2019-05-17  7:31 ` [PATCH 07/20] xfs: split iop_unlock Christoph Hellwig
2019-05-17 17:49   ` Brian Foster
2019-05-20  6:10     ` Christoph Hellwig
2019-05-20 11:38       ` Brian Foster
2019-05-17  7:31 ` [PATCH 08/20] xfs: add a flag to release log items on commit Christoph Hellwig
2019-05-17 17:50   ` Brian Foster
2019-05-20  6:11     ` Christoph Hellwig
2019-05-17  7:31 ` [PATCH 09/20] xfs: don't cast inode_log_items to get the log_item Christoph Hellwig
2019-05-17 17:50   ` Brian Foster
2019-05-17  7:31 ` [PATCH 10/20] xfs: remove the xfs_log_item_t typedef Christoph Hellwig
2019-05-17 17:50   ` Brian Foster
2019-05-17  7:31 ` [PATCH 11/20] xfs: use a list_head for iclog callbacks Christoph Hellwig
2019-05-20 13:12   ` Brian Foster
2019-05-20 13:19     ` Christoph Hellwig
2019-05-20 13:25       ` Brian Foster
2019-05-20 13:27       ` Bryan Gurney
2019-05-20 13:31         ` Christoph Hellwig
2019-05-17  7:31 ` [PATCH 12/20] xfs: remove a pointless comment duplicated above all xfs_item_ops instances Christoph Hellwig
2019-05-20 13:12   ` Brian Foster
2019-05-17  7:31 ` [PATCH 13/20] xfs: merge xfs_efd_init into xfs_trans_get_efd Christoph Hellwig
2019-05-17  8:16   ` Nikolay Borisov
2019-05-17  8:27     ` Christoph Hellwig
2019-05-17 18:26   ` Eric Sandeen
2019-05-20  6:03     ` Christoph Hellwig
2019-05-20 13:12   ` Brian Foster
2019-05-17  7:31 ` [PATCH 14/20] xfs: merge xfs_cud_init into xfs_trans_get_cud Christoph Hellwig
2019-05-20 13:13   ` Brian Foster
2019-05-17  7:31 ` [PATCH 15/20] xfs: merge xfs_rud_init into xfs_trans_get_rud Christoph Hellwig
2019-05-20 13:13   ` Brian Foster
2019-05-17  7:31 ` [PATCH 16/20] xfs: merge xfs_bud_init into xfs_trans_get_bud Christoph Hellwig
2019-05-20 13:13   ` Brian Foster
2019-05-17  7:31 ` [PATCH 17/20] xfs: merge xfs_trans_extfree.c into xfs_extfree_item.c Christoph Hellwig
2019-05-20 13:13   ` Brian Foster
2019-05-17  7:31 ` [PATCH 18/20] xfs: merge xfs_trans_refcount.c into xfs_refcount_item.c Christoph Hellwig
2019-05-20 13:14   ` Brian Foster
2019-05-17  7:31 ` [PATCH 19/20] xfs: merge xfs_trans_rmap.c into xfs_rmap_item.c Christoph Hellwig
2019-05-20 13:14   ` Brian Foster
2019-05-17  7:31 ` [PATCH 20/20] xfs: merge xfs_trans_bmap.c into xfs_bmap_item.c Christoph Hellwig
2019-05-20 13:14   ` Brian Foster
  -- strict thread matches above, loose matches on Subject: below --
2019-06-13 18:02 misc log item related cleanups v2 Christoph Hellwig
2019-06-13 18:02 ` [PATCH 06/20] xfs: don't use xfs_trans_free_items in the commit path 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=20190517140853.GF7888@bfoster \
    --to=bfoster@redhat.com \
    --cc=hch@lst.de \
    --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