Linux XFS filesystem development
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: cem@kernel.org
Cc: djwong@kernel.org, hch@lst.de, sandeen@sandeen.net,
	linux-xfs@vger.kernel.org
Subject: Re: [PATCH v3 2/3] xfs: enable xfs_trans_cancel() to report and error code
Date: Mon, 21 Sep 2026 10:33:56 +0200	[thread overview]
Message-ID: <20260921083356.GB20936@lst.de> (raw)
In-Reply-To: <20260917103633.14703-3-cem@kernel.org>

On Thu, Sep 17, 2026 at 12:35:47PM +0200, cem@kernel.org wrote:
> From: Carlos Maiolino <cem@kernel.org>
> 
> Once in a while it's useful to know exactly what kind of error caused a
> transaction to be cancelled.
> Enable xfs_trans_cancel() to receive an error code to be reported.
> 
> Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
> ---
> V3:
> 	- Kill typedef from __xfs_trans_cancel
> 	- Remove uneeded wrap of parameter 0
> V2:
> 	- Parenthesize macro parameters
> 
>  fs/xfs/xfs_trans.c | 8 +++++---
>  fs/xfs/xfs_trans.h | 6 +++++-
>  2 files changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
> index 5c522790e5be..395c896673fe 100644
> --- a/fs/xfs/xfs_trans.c
> +++ b/fs/xfs/xfs_trans.c
> @@ -943,8 +943,9 @@ xfs_trans_commit(
>   * xfs_trans_commit().
>   */
>  void
> -xfs_trans_cancel(
> -	struct xfs_trans	*tp)
> +__xfs_trans_cancel(
> +	struct xfs_trans	*tp,
> +	int			error)
>  {
>  	struct xfs_mount	*mp = tp->t_mountp;
>  	struct xlog		*log = mp->m_log;
> @@ -971,7 +972,8 @@ xfs_trans_cancel(
>  	 * here.
>  	 */
>  	if (dirty && !xfs_is_shutdown(mp)) {
> -		XFS_ERROR_REPORT("xfs_trans_cancel", XFS_ERRLEVEL_LOW, 0, mp);
> +		XFS_ERROR_REPORT("xfs_trans_cancel", XFS_ERRLEVEL_LOW,
> +				 error, mp);
>  		xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
>  	}
>  #ifdef DEBUG
> diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h
> index eb83c5dac032..36a49622b870 100644
> --- a/fs/xfs/xfs_trans.h
> +++ b/fs/xfs/xfs_trans.h
> @@ -213,6 +213,11 @@ xfs_trans_read_buf(
>  				      flags, bpp, ops);
>  }
>  
> +void __xfs_trans_cancel(struct xfs_trans *, int);
> +
> +#define xfs_trans_cancel(tp) __xfs_trans_cancel((tp), 0)
> +#define xfs_trans_cancel_error(tp, error) __xfs_trans_cancel((tp), (error))

Can we turn these into inlines instead of macros?

And do away with the pointless __xfs_trans_cancel, just implement
xfs_trans_cancel_error in xfs_trans.c, and wrap xfs_trans_cancel around
it.


  reply	other threads:[~2026-09-21  8:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-17 10:35 [PATCH v3 0/3] Enable xfs error reporting to print out error codes cem
2026-09-17 10:35 ` [PATCH v3 1/3] xfs: add xfs_error_report the ability to display an error code cem
2026-09-21  3:36   ` Darrick J. Wong
2026-09-21  8:33   ` Christoph Hellwig
2026-09-17 10:35 ` [PATCH v3 2/3] xfs: enable xfs_trans_cancel() to report and " cem
2026-09-21  8:33   ` Christoph Hellwig [this message]
2026-09-23 10:49     ` Carlos Maiolino
2026-09-23 14:39       ` Christoph Hellwig
2026-09-17 10:35 ` [PATCH v3 3/3] xfs: make xfs_iomap_write_direct() report an error to xfs_trans_cancel cem
2026-09-21  8:34   ` 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=20260921083356.GB20936@lst.de \
    --to=hch@lst.de \
    --cc=cem@kernel.org \
    --cc=djwong@kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@sandeen.net \
    /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