Skip to contentSkip to conversation

f2fs: use printk_ratelimited to avoid redundant logs

PATCH In review Chao Yu 2 participants 3 messages Jan 24, 2024 – Jan 26, 2024 F2FS file system

lore
Share & tools
lore

Chao Yu

author maintainer
#0 lore raw

PATCH 1/1 f2fs: use printk_ratelimited to avoid redundant logs

Use printk_ratelimited() instead of f2fs_err() in f2fs_record_stop_reason(), and f2fs_record_errors() to avoid redundant logs.

---
 fs/f2fs/super.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
fs/f2fs/super.c +6 -3
index e2c066fbc0fa..7e437aea268e 100644
@@ -4091,7 +4091,9 @@ static void f2fs_record_stop_reason(struct f2fs_sb_info *sbi)
 
 	f2fs_up_write(&sbi->sb_lock);
 	if (err)
-		f2fs_err(sbi, "f2fs_commit_super fails to record err:%d", err);
+		printk_ratelimited(
+			"%sF2FS-fs (%s): f2fs_commit_super fails to record stop_reason, err:%d\n",
+			KERN_ERR, sbi->sb->s_id, err);
 }
 
 void f2fs_save_errors(struct f2fs_sb_info *sbi, unsigned char flag)
@@ -4134,8 +4136,9 @@ static void f2fs_record_errors(struct f2fs_sb_info *sbi, unsigned char error)
 
 	err = f2fs_commit_super(sbi, false);
 	if (err)
-		f2fs_err(sbi, "f2fs_commit_super fails to record errors:%u, err:%d",
-								error, err);
+		printk_ratelimited(
+			"%sF2FS-fs (%s): f2fs_commit_super fails to record errors:%u, err:%d\n",
+			KERN_ERR, sbi->sb->s_id, error, err);
 out_unlock:
 	f2fs_up_write(&sbi->sb_lock);
 }
Signature · 1 line
2.40.1
maintainer
#1 lore raw
Quoted 13 lines · Chao Yu

Use printk_ratelimited() instead of f2fs_err() in f2fs_record_stop_reason(), and f2fs_record_errors() to avoid redundant logs.

---
 fs/f2fs/super.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
fs/f2fs/super.c +0 -0
index e2c066fbc0fa..7e437aea268e 100644

fs/f2fs/super.c static void f2fs_record_stop_reason(struct f2fs_sb_info *sbi) · line 4094

Quoted 4 lines
fs/f2fs/super.c +0 -1
@@ -4091,7 +4091,9 @@ static void f2fs_record_stop_reason(struct f2fs_sb_info *sbi)
 
 	f2fs_up_write(&sbi->sb_lock);
 	if (err)
-		f2fs_err(sbi, "f2fs_commit_super fails to record err:%d", err);

Needing f2fs_err_ratelimited()?

Quoted 20 lines
fs/f2fs/super.c +6 -2
+		printk_ratelimited(
+			"%sF2FS-fs (%s): f2fs_commit_super fails to record stop_reason, err:%d\n",
+			KERN_ERR, sbi->sb->s_id, err);
 }
 
 void f2fs_save_errors(struct f2fs_sb_info *sbi, unsigned char flag)
@@ -4134,8 +4136,9 @@ static void f2fs_record_errors(struct f2fs_sb_info *sbi, unsigned char error)
 
 	err = f2fs_commit_super(sbi, false);
 	if (err)
-		f2fs_err(sbi, "f2fs_commit_super fails to record errors:%u, err:%d",
-								error, err);
+		printk_ratelimited(
+			"%sF2FS-fs (%s): f2fs_commit_super fails to record errors:%u, err:%d\n",
+			KERN_ERR, sbi->sb->s_id, error, err);
 out_unlock:
 	f2fs_up_write(&sbi->sb_lock);
 }
Signature · 1 line
2.40.1
author maintainer
#2 lore raw
Quoted 15 lines · Jaegeuk Kim
Quoted 14 lines · Chao Yu

Use printk_ratelimited() instead of f2fs_err() in f2fs_record_stop_reason(), and f2fs_record_errors() to avoid redundant logs.

---
  fs/f2fs/super.c | 9 ++++++---
  1 file changed, 6 insertions(+), 3 deletions(-)
fs/f2fs/super.c +0 -0
index e2c066fbc0fa..7e437aea268e 100644
@@ -4091,7 +4091,9 @@ static void f2fs_record_stop_reason(struct f2fs_sb_info *sbi)
 
Quoted 5 lines

fs/f2fs/super.c static void f2fs_record_stop_reason(struct f2fs_sb_info *sbi) · line 4094

Quoted 3 lines
fs/f2fs/super.c +0 -1
  	f2fs_up_write(&sbi->sb_lock);
  	if (err)
-		f2fs_err(sbi, "f2fs_commit_super fails to record err:%d", err);

Needing f2fs_err_ratelimited()?

Yes, more clean, let me update in v2.

Thanks,

Quoted 21 lines
Quoted 21 lines
fs/f2fs/super.c +6 -2
+		printk_ratelimited(
+			"%sF2FS-fs (%s): f2fs_commit_super fails to record stop_reason, err:%d\n",
+			KERN_ERR, sbi->sb->s_id, err);
  }
 
  void f2fs_save_errors(struct f2fs_sb_info *sbi, unsigned char flag)
@@ -4134,8 +4136,9 @@ static void f2fs_record_errors(struct f2fs_sb_info *sbi, unsigned char error)
 
  	err = f2fs_commit_super(sbi, false);
  	if (err)
-		f2fs_err(sbi, "f2fs_commit_super fails to record errors:%u, err:%d",
-								error, err);
+		printk_ratelimited(
+			"%sF2FS-fs (%s): f2fs_commit_super fails to record errors:%u, err:%d\n",
+			KERN_ERR, sbi->sb->s_id, error, err);
  out_unlock:
  	f2fs_up_write(&sbi->sb_lock);
  }
Signature · 1 line
2.40.1