public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chao Yu <chao@kernel.org>
To: jaegeuk@kernel.org
Cc: linux-f2fs-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, Chao Yu <chao@kernel.org>
Subject: [PATCH v3 2/2] f2fs: use more generic f2fs_stop_checkpoint()
Date: Mon, 23 Mar 2026 16:38:33 +0800	[thread overview]
Message-ID: <20260323083834.156393-2-chao@kernel.org> (raw)
In-Reply-To: <20260323083834.156393-1-chao@kernel.org>

Let's use more generic f2fs_stop_checkpoint() instead of
f2fs_handle_critical_error() to handle critical error in f2fs.

Signed-off-by: Chao Yu <chao@kernel.org>
---
v3:
This patch depends on "f2fs: call f2fs_handle_critical_error() to set
cp_error flag", so send it as a patchset.
 fs/f2fs/checkpoint.c |  9 ---------
 fs/f2fs/f2fs.h       |  3 +--
 fs/f2fs/node.c       |  2 +-
 fs/f2fs/super.c      | 13 ++++++++++++-
 4 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 6dd39b7de11a..01e1ba77263e 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -232,15 +232,6 @@ static inline void f2fs_unlock_all(struct f2fs_sb_info *sbi)
 static struct kmem_cache *ino_entry_slab;
 struct kmem_cache *f2fs_inode_entry_slab;
 
-void f2fs_stop_checkpoint(struct f2fs_sb_info *sbi, bool end_io,
-						unsigned char reason)
-{
-	f2fs_build_fault_attr(sbi, 0, 0, FAULT_ALL);
-	if (!end_io)
-		f2fs_flush_merged_writes(sbi);
-	f2fs_handle_critical_error(sbi, reason);
-}
-
 /*
  * We guarantee no failure on the returned page.
  */
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 94cf1e78d892..247eae5eb83b 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -3905,7 +3905,6 @@ int f2fs_do_quota_sync(struct super_block *sb, int type);
 loff_t max_file_blocks(struct inode *inode);
 void f2fs_quota_off_umount(struct super_block *sb);
 void f2fs_save_errors(struct f2fs_sb_info *sbi, unsigned char flag);
-void f2fs_handle_critical_error(struct f2fs_sb_info *sbi, unsigned char reason);
 void f2fs_handle_error(struct f2fs_sb_info *sbi, unsigned char error);
 int f2fs_commit_super(struct f2fs_sb_info *sbi, bool recover);
 int f2fs_sync_fs(struct super_block *sb, int sync);
@@ -5090,7 +5089,7 @@ static inline void f2fs_handle_page_eio(struct f2fs_sb_info *sbi,
 				f2fs_bug_on(sbi, 1);
 				return;
 			}
-			f2fs_handle_critical_error(sbi, stop_reason);
+			f2fs_stop_checkpoint(sbi, false, stop_reason);
 		}
 	} else {
 		sbi->page_eio_ofs[type] = ofs;
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 17eab01ae8f9..0de41526f28a 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -1779,7 +1779,7 @@ static bool __write_node_folio(struct folio *folio, bool atomic, bool *submitted
 
 	if (f2fs_sanity_check_node_footer(sbi, folio, nid,
 					NODE_TYPE_REGULAR, false)) {
-		f2fs_handle_critical_error(sbi, STOP_CP_REASON_CORRUPTED_NID);
+		f2fs_stop_checkpoint(sbi, false, STOP_CP_REASON_CORRUPTED_NID);
 		goto redirty_out;
 	}
 
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index bd9785a3c805..5b552f08fe7b 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -4663,7 +4663,8 @@ static bool system_going_down(void)
 		|| system_state == SYSTEM_RESTART;
 }
 
-void f2fs_handle_critical_error(struct f2fs_sb_info *sbi, unsigned char reason)
+static void f2fs_handle_critical_error(struct f2fs_sb_info *sbi,
+						unsigned char reason)
 {
 	struct super_block *sb = sbi->sb;
 	bool shutdown = reason == STOP_CP_REASON_SHUTDOWN;
@@ -4720,6 +4721,16 @@ void f2fs_handle_critical_error(struct f2fs_sb_info *sbi, unsigned char reason)
 	 */
 }
 
+void f2fs_stop_checkpoint(struct f2fs_sb_info *sbi, bool end_io,
+						unsigned char reason)
+{
+	f2fs_build_fault_attr(sbi, 0, 0, FAULT_ALL);
+	if (!end_io)
+		f2fs_flush_merged_writes(sbi);
+	f2fs_handle_critical_error(sbi, reason);
+}
+
+
 static void f2fs_record_error_work(struct work_struct *work)
 {
 	struct f2fs_sb_info *sbi = container_of(work,
-- 
2.49.0


  reply	other threads:[~2026-03-23  8:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-23  8:38 [PATCH v3 1/2] f2fs: call f2fs_handle_critical_error() to set cp_error flag Chao Yu
2026-03-23  8:38 ` Chao Yu [this message]
2026-03-24 17:32 ` [f2fs-dev] " patchwork-bot+f2fs

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=20260323083834.156393-2-chao@kernel.org \
    --to=chao@kernel.org \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@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