Skip to contentSkip to conversation

f2fs: warn on when fsck flag is set

PATCH Superseded Yangtao Li 2 participants 2 messages Aug 11, 2021 F2FS file system

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Yangtao Li

author
#0 lore raw

PATCH v2 1/1 f2fs: warn on when fsck flag is set

SBI_NEED_FSCK is an indicator that fsck.f2fs needs to be triggered, this flag is set in too many places. For some scenes that are not very reproducible, adding stack information will help locate the problem.

---
v2:
-convert to WARN_ON
-one more blank

 fs/f2fs/f2fs.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/f2fs/f2fs.h +3 -1
index 67faa43cc141..2e2294234c0d 100644
@@ -33,7 +33,7 @@
 #else
 #define f2fs_bug_on(sbi, condition)					\
 	do {								\
-		if (WARN_ON(condition))					\
+		if ((condition))					\
 			set_sbi_flag(sbi, SBI_NEED_FSCK);		\
 	} while (0)
 #endif
@@ -1999,6 +1999,8 @@ static inline bool is_sbi_flag_set(struct f2fs_sb_info *sbi, unsigned int type)
 
 static inline void set_sbi_flag(struct f2fs_sb_info *sbi, unsigned int type)
 {
+	WARN_ON(type ==  SBI_NEED_FSCK);
+
 	set_bit(type, &sbi->s_flag);
 }
 
Signature · 1 line
2.32.0
maintainer
#1 lore raw
Quoted 17 lines · Yangtao Li

SBI_NEED_FSCK is an indicator that fsck.f2fs needs to be triggered, this flag is set in too many places. For some scenes that are not very reproducible, adding stack information will help locate the problem.

---
v2:

(quoted diff) +0 -2
-convert to WARN_ON
-one more blank
  fs/f2fs/f2fs.h | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
fs/f2fs/f2fs.h +0 -0
index 67faa43cc141..2e2294234c0d 100644

fs/f2fs/f2fs.h line 36

Quoted 5 lines
fs/f2fs/f2fs.h +1 -1
@@ -33,7 +33,7 @@
  #else
  #define f2fs_bug_on(sbi, condition)					\
  	do {								\
-		if (WARN_ON(condition))					\
+		if ((condition))					\

Why removing WARN_ON()?

fs/f2fs/f2fs.h static inline bool is_sbi_flag_set(struct f2fs_sb_info *sbi, unsigned int type) · line 2002

Quoted 8 lines
fs/f2fs/f2fs.h +1 -0
  			set_sbi_flag(sbi, SBI_NEED_FSCK);		\
  	} while (0)
  #endif
@@ -1999,6 +1999,8 @@ static inline bool is_sbi_flag_set(struct f2fs_sb_info *sbi, unsigned int type)
 
  static inline void set_sbi_flag(struct f2fs_sb_info *sbi, unsigned int type)
  {
+	WARN_ON(type ==  SBI_NEED_FSCK);

Again, please remove one unnecessary blank character before SBI_NEED_FSCK.

WARN_ON_ONCE(type == SBI_NEED_FSCK)

fs/f2fs/f2fs.h static inline bool is_sbi_flag_set(struct f2fs_sb_info *sbi, unsigned int type) · line 2003

Quoted 1 line
fs/f2fs/f2fs.h +1 -0
+

No need to add blank line.

Thanks,

Quoted 4 lines
fs/f2fs/f2fs.h +0 -0
  	set_bit(type, &sbi->s_flag);
  }