Linux XFS filesystem development
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Carlos Maiolino <cem@kernel.org>, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 7/8] xfs: return the allocated transaction from xrep_trans_alloc_hook_dummy
Date: Tue, 15 Jul 2025 08:18:11 -0700	[thread overview]
Message-ID: <20250715151811.GZ2672049@frogsfrogsfrogs> (raw)
In-Reply-To: <20250715122544.1943403-8-hch@lst.de>

On Tue, Jul 15, 2025 at 02:25:40PM +0200, Christoph Hellwig wrote:
> xrep_trans_alloc_hook_dummy can't return errors, so return the allocated
> transaction directly instead of an output double pointer argument.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  fs/xfs/scrub/repair.c        | 8 +++-----
>  fs/xfs/scrub/repair.h        | 4 ++--
>  fs/xfs/scrub/rmap_repair.c   | 5 +----
>  fs/xfs/scrub/rtrmap_repair.c | 5 +----
>  4 files changed, 7 insertions(+), 15 deletions(-)
> 
> diff --git a/fs/xfs/scrub/repair.c b/fs/xfs/scrub/repair.c
> index f7f80ff32afc..79251c595e18 100644
> --- a/fs/xfs/scrub/repair.c
> +++ b/fs/xfs/scrub/repair.c
> @@ -1273,16 +1273,14 @@ xrep_setup_xfbtree(
>   * function MUST NOT be called from regular repair code because the current
>   * process' transaction is saved via the cookie.
>   */
> -int
> +struct xfs_trans *
>  xrep_trans_alloc_hook_dummy(
>  	struct xfs_mount	*mp,
> -	void			**cookiep,
> -	struct xfs_trans	**tpp)
> +	void			**cookiep)
>  {
>  	*cookiep = current->journal_info;
>  	current->journal_info = NULL;

You could get rid of all this journal_info manipulation because xfs no
longer uses that to track the current transaction.

--D

> -	*tpp = xfs_trans_alloc_empty(mp);
> -	return 0;
> +	return xfs_trans_alloc_empty(mp);
>  }
>  
>  /* Cancel a dummy transaction used by a live update hook function. */
> diff --git a/fs/xfs/scrub/repair.h b/fs/xfs/scrub/repair.h
> index af0a3a9e5ed9..0a808e903cf5 100644
> --- a/fs/xfs/scrub/repair.h
> +++ b/fs/xfs/scrub/repair.h
> @@ -180,8 +180,8 @@ int xrep_quotacheck(struct xfs_scrub *sc);
>  int xrep_reinit_pagf(struct xfs_scrub *sc);
>  int xrep_reinit_pagi(struct xfs_scrub *sc);
>  
> -int xrep_trans_alloc_hook_dummy(struct xfs_mount *mp, void **cookiep,
> -		struct xfs_trans **tpp);
> +struct xfs_trans *xrep_trans_alloc_hook_dummy(struct xfs_mount *mp,
> +		void **cookiep);
>  void xrep_trans_cancel_hook_dummy(void **cookiep, struct xfs_trans *tp);
>  
>  bool xrep_buf_verify_struct(struct xfs_buf *bp, const struct xfs_buf_ops *ops);
> diff --git a/fs/xfs/scrub/rmap_repair.c b/fs/xfs/scrub/rmap_repair.c
> index bf1e632b449a..6024872a17e5 100644
> --- a/fs/xfs/scrub/rmap_repair.c
> +++ b/fs/xfs/scrub/rmap_repair.c
> @@ -1621,9 +1621,7 @@ xrep_rmapbt_live_update(
>  
>  	trace_xrep_rmap_live_update(pag_group(rr->sc->sa.pag), action, p);
>  
> -	error = xrep_trans_alloc_hook_dummy(mp, &txcookie, &tp);
> -	if (error)
> -		goto out_abort;
> +	tp = xrep_trans_alloc_hook_dummy(mp, &txcookie);
>  
>  	mutex_lock(&rr->lock);
>  	mcur = xfs_rmapbt_mem_cursor(rr->sc->sa.pag, tp, &rr->rmap_btree);
> @@ -1644,7 +1642,6 @@ xrep_rmapbt_live_update(
>  out_cancel:
>  	xfbtree_trans_cancel(&rr->rmap_btree, tp);
>  	xrep_trans_cancel_hook_dummy(&txcookie, tp);
> -out_abort:
>  	mutex_unlock(&rr->lock);
>  	xchk_iscan_abort(&rr->iscan);
>  out_unlock:
> diff --git a/fs/xfs/scrub/rtrmap_repair.c b/fs/xfs/scrub/rtrmap_repair.c
> index 4a56726d9952..5b8155c87873 100644
> --- a/fs/xfs/scrub/rtrmap_repair.c
> +++ b/fs/xfs/scrub/rtrmap_repair.c
> @@ -855,9 +855,7 @@ xrep_rtrmapbt_live_update(
>  
>  	trace_xrep_rmap_live_update(rtg_group(rr->sc->sr.rtg), action, p);
>  
> -	error = xrep_trans_alloc_hook_dummy(mp, &txcookie, &tp);
> -	if (error)
> -		goto out_abort;
> +	tp = xrep_trans_alloc_hook_dummy(mp, &txcookie);
>  
>  	mutex_lock(&rr->lock);
>  	mcur = xfs_rtrmapbt_mem_cursor(rr->sc->sr.rtg, tp, &rr->rtrmap_btree);
> @@ -878,7 +876,6 @@ xrep_rtrmapbt_live_update(
>  out_cancel:
>  	xfbtree_trans_cancel(&rr->rtrmap_btree, tp);
>  	xrep_trans_cancel_hook_dummy(&txcookie, tp);
> -out_abort:
>  	xchk_iscan_abort(&rr->iscan);
>  	mutex_unlock(&rr->lock);
>  out_unlock:
> -- 
> 2.47.2
> 
> 

  reply	other threads:[~2025-07-15 15:18 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-15 12:25 cleanup transaction allocation Christoph Hellwig
2025-07-15 12:25 ` [PATCH 1/8] xfs: use xfs_trans_reserve_more in xfs_trans_reserve_more_inode Christoph Hellwig
2025-07-15 14:47   ` Darrick J. Wong
2025-07-15 12:25 ` [PATCH 2/8] xfs: don't use xfs_trans_reserve in xfs_trans_reserve_more Christoph Hellwig
2025-07-15 14:49   ` Darrick J. Wong
2025-07-15 15:35     ` Christoph Hellwig
2025-07-15 15:55       ` Darrick J. Wong
2025-07-15 12:25 ` [PATCH 3/8] xfs: decouple xfs_trans_alloc_empty from xfs_trans_alloc Christoph Hellwig
2025-07-15 14:54   ` Darrick J. Wong
2025-07-15 12:25 ` [PATCH 4/8] xfs: don't use xfs_trans_reserve in xfs_trans_roll Christoph Hellwig
2025-07-15 14:59   ` Darrick J. Wong
2025-07-15 12:25 ` [PATCH 5/8] xfs: return the allocated transaction from xfs_trans_alloc_empty Christoph Hellwig
2025-07-15 14:59   ` Darrick J. Wong
2025-07-15 12:25 ` [PATCH 6/8] xfs: return the allocated transaction from xchk_trans_alloc_empty Christoph Hellwig
2025-07-15 14:59   ` Darrick J. Wong
2025-07-15 12:25 ` [PATCH 7/8] xfs: return the allocated transaction from xrep_trans_alloc_hook_dummy Christoph Hellwig
2025-07-15 15:18   ` Darrick J. Wong [this message]
2025-07-15 15:36     ` Christoph Hellwig
2025-07-15 12:25 ` [PATCH 8/8] xfs: remove the xlog_ticket_t typedef Christoph Hellwig
2025-07-15 15:18   ` 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=20250715151811.GZ2672049@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=cem@kernel.org \
    --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