All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jaegeuk Kim via Linux-f2fs-devel <linux-f2fs-devel@lists.sourceforge.net>
To: liujinbao1 <jinbaoliu365@gmail.com>
Cc: shengyong1 <shengyong1@xiaomi.com>,
	liujinbao1 <liujinbao1@xiaomi.com>,
	linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH] [PATCH v2] f2fs: Add trace_f2fs_fault_report
Date: Fri, 1 May 2026 04:58:17 +0000	[thread overview]
Message-ID: <afQy6Vy_d2ySs6xC@google.com> (raw)
In-Reply-To: <20260415114237.3089952-1-jinbaoliu365@gmail.com>

It seems this patch fails to build on linux-next. Could you please check?

On 04/15, liujinbao1 wrote:
> From: liujinbao1 <liujinbao1@xiaomi.com>
> 
> Add trace_f2fs_fault_report to trigger reporting upon f2fs_bug_on,
> need_fsck, stop_checkpoint, and handle_eio. Since f2fs_bug_on and
> need_fsck can be triggered in hundreds of scenarios, define set_sbi_flag
> as a macro to help capture the effective fault function and line number.
> 
> Signed-off-by: shengyong1 <shengyong1@xiaomi.com>
> Signed-off-by: liujinbao1 <liujinbao1@xiaomi.com>
> ---
>  fs/f2fs/f2fs.h              | 18 +++++++++++++++++-
>  fs/f2fs/super.c             |  9 +++++++++
>  include/trace/events/f2fs.h | 28 ++++++++++++++++++++++++++++
>  3 files changed, 54 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> index 56c4af4b1737..2249a68d6bf5 100644
> --- a/fs/f2fs/f2fs.h
> +++ b/fs/f2fs/f2fs.h
> @@ -97,6 +97,15 @@ extern const char *f2fs_fault_name[FAULT_MAX];
>  #define DEFAULT_FAILURE_RETRY_COUNT		1
>  #endif
>  
> +enum {
> +	REPORT_FAULT_NEED_FSCK,
> +	REPORT_FAULT_STOP_CP,
> +	REPORT_FAULT_MAX,
> +};
> +
> +void f2fs_fault_report(struct super_block *sb, unsigned int err_code,
> +			const char *func, unsigned int data);
> +
>  /*
>   * For mount options
>   */
> @@ -2278,11 +2287,18 @@ static inline bool is_sbi_flag_set(struct f2fs_sb_info *sbi, unsigned int type)
>  	return test_bit(type, &sbi->s_flag);
>  }
>  
> -static inline void set_sbi_flag(struct f2fs_sb_info *sbi, unsigned int type)
> +static inline void __set_sbi_flag(struct f2fs_sb_info *sbi, unsigned int type)
>  {
>  	set_bit(type, &sbi->s_flag);
>  }
>  
> +#define set_sbi_flag(sbi, type)				\
> +do {							\
> +	__set_sbi_flag(sbi, type);			\
> +	if ((type) == SBI_NEED_FSCK)			\
> +		f2fs_fault_report(sbi->sb, REPORT_FAULT_NEED_FSCK, __func__, __LINE__);	\
> +} while (0)
> +
>  static inline void clear_sbi_flag(struct f2fs_sb_info *sbi, unsigned int type)
>  {
>  	clear_bit(type, &sbi->s_flag);
> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> index ccf806b676f5..b431842751d6 100644
> --- a/fs/f2fs/super.c
> +++ b/fs/f2fs/super.c
> @@ -4724,9 +4724,18 @@ static void f2fs_handle_critical_error(struct f2fs_sb_info *sbi,
>  	 */
>  }
>  
> +void f2fs_fault_report(struct super_block *sb, unsigned int err_code,
> +			const char *func, unsigned int data)
> +{
> +	trace_f2fs_fault_report(sb, err_code, func, data);
> +}
> +
>  void f2fs_stop_checkpoint(struct f2fs_sb_info *sbi, bool end_io,
>  						unsigned char reason)
>  {
> +	if (reason != STOP_CP_REASON_SHUTDOWN)
> +		f2fs_fault_report(sbi->sb, REPORT_FAULT_STOP_CP, __func__, reason);
> +
>  	f2fs_build_fault_attr(sbi, 0, 0, FAULT_ALL);
>  	if (!end_io)
>  		f2fs_flush_merged_writes(sbi);
> diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h
> index 9364e6775562..b97bc3bf499a 100644
> --- a/include/trace/events/f2fs.h
> +++ b/include/trace/events/f2fs.h
> @@ -2582,6 +2582,34 @@ DEFINE_EVENT(f2fs_priority_update, f2fs_priority_restore,
>  	TP_ARGS(sbi, lock_name, is_write, p, orig_prio, new_prio)
>  );
>  
> +TRACE_EVENT(f2fs_fault_report,
> +
> +	TP_PROTO(struct super_block *sb, unsigned int err_code,
> +		const char *func, unsigned int data),
> +
> +	TP_ARGS(sb, err_code, func, data),
> +
> +	TP_STRUCT__entry(
> +		__field(dev_t, dev)
> +		__field(unsigned int, err_code)
> +		__string(func, func)
> +		__field(unsigned int, data)
> +	),
> +
> +	TP_fast_assign(
> +		__entry->dev		= sb->s_dev;
> +		__entry->err_code	= err_code;
> +		__assign_str(func, func);
> +		__entry->data		= data;
> +	),
> +
> +	TP_printk("dev = (%d,%d), err_code = %u, func = %s, data = %u",
> +		show_dev(__entry->dev),
> +		__entry->err_code,
> +		__get_str(func),
> +		__entry->data)
> +);
> +
>  #endif /* _TRACE_F2FS_H */
>  
>   /* This part must be outside protection */
> -- 
> 2.43.0


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

      parent reply	other threads:[~2026-05-01  4:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-15 11:42 [f2fs-dev] [PATCH] [PATCH v2] f2fs: Add trace_f2fs_fault_report liujinbao1
2026-04-17  1:26 ` Chao Yu via Linux-f2fs-devel
     [not found]   ` <5a216f80-fe22-4134-abb7-28fbd0731b52@gmail.com>
2026-04-17  7:42     ` Chao Yu via Linux-f2fs-devel
2026-04-17  7:43 ` Chao Yu via Linux-f2fs-devel
2026-05-01  4:58 ` Jaegeuk Kim via Linux-f2fs-devel [this message]

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=afQy6Vy_d2ySs6xC@google.com \
    --to=linux-f2fs-devel@lists.sourceforge.net \
    --cc=jaegeuk@kernel.org \
    --cc=jinbaoliu365@gmail.com \
    --cc=liujinbao1@xiaomi.com \
    --cc=shengyong1@xiaomi.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.