Skip to contentSkip to conversation

f2fs: correct comment in segment.h

PATCH In review Yangtao Li 2 participants 4 messages Aug 10, 2021 – Aug 11, 2021 F2FS file system

lore
Share & tools
lore

Yangtao Li

author
#0 lore raw

PATCH 1/1 f2fs: correct comment in segment.h

s/two/three

---
 fs/f2fs/segment.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/f2fs/segment.h +2 -2
index 050230c70a53..89fff258727d 100644
@@ -142,7 +142,7 @@ enum {
 };
 
 /*
- * In the victim_sel_policy->alloc_mode, there are two block allocation modes.
+ * In the victim_sel_policy->alloc_mode, there are three block allocation modes.
  * LFS writes data sequentially with cleaning operations.
  * SSR (Slack Space Recycle) reuses obsolete space without cleaning operations.
  * AT_SSR (Age Threshold based Slack Space Recycle) merges fragments into
@@ -155,7 +155,7 @@ enum {
 };
 
 /*
- * In the victim_sel_policy->gc_mode, there are two gc, aka cleaning, modes.
+ * In the victim_sel_policy->gc_mode, there are three gc, aka cleaning, modes.
  * GC_CB is based on cost-benefit algorithm.
  * GC_GREEDY is based on greedy algorithm.
  * GC_AT is based on age-threshold algorithm.
Signature · 8 lines
2.32.0



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
author
#1 lore raw

PATCH 1/1 f2fs: improve sbi status info in debugfs/f2fs/status

Do not use numbers but strings to improve readability.

---
 fs/f2fs/debug.c | 28 +++++++++++++++++++++++-----
 1 file changed, 23 insertions(+), 5 deletions(-)
fs/f2fs/debug.c +23 -5
index 473ad04d1891..91c0910b0bb7 100644
@@ -323,22 +323,40 @@ static void update_mem_info(struct f2fs_sb_info *sbi)
 #endif
 }
 
+static char *s_flag[] = {
+	[SBI_IS_DIRTY]		= " dirty",
+	[SBI_IS_CLOSE]		= " close",
+	[SBI_NEED_FSCK]		= " fsck",
+	[SBI_POR_DOING]		= " doing",
+	[SBI_NEED_SB_WRITE]	= " sb_write",
+	[SBI_NEED_CP]		= " cp",
+	[SBI_IS_SHUTDOWN]	= " shutdown",
+	[SBI_IS_RECOVERED]	= " recovered",
+	[SBI_CP_DISABLED]	= " cp_disabled",
+	[SBI_CP_DISABLED_QUICK]	= " cp_disabled_quick",
+	[SBI_QUOTA_NEED_FLUSH]	= " quota_need_flush",
+	[SBI_QUOTA_SKIP_FLUSH]	= " quota_skip_flush",
+	[SBI_QUOTA_NEED_REPAIR]	= " quota_need_repair",
+	[SBI_IS_RESIZEFS]	= " resizefs",
+};
+
 static int stat_show(struct seq_file *s, void *v)
 {
 	struct f2fs_stat_info *si;
-	int i = 0;
-	int j;
+	int i = 0, j = 0;
 
 	mutex_lock(&f2fs_stat_mutex);
 	list_for_each_entry(si, &f2fs_stat_list, stat_list) {
 		update_general_status(si->sbi);
 
-		seq_printf(s, "\n=====[ partition info(%pg). #%d, %s, CP: %s (sbi: 0x%lx)]=====\n",
+		seq_printf(s, "\n=====[ partition info(%pg). #%d, %s, CP: %s (sbi:",
 			si->sbi->sb->s_bdev, i++,
 			f2fs_readonly(si->sbi->sb) ? "RO": "RW",
 			is_set_ckpt_flags(si->sbi, CP_DISABLED_FLAG) ?
-			"Disabled": (f2fs_cp_error(si->sbi) ? "Error": "Good"),
-			si->sbi->s_flag);
+			"Disabled" : (f2fs_cp_error(si->sbi) ? "Error" : "Good"));
+		for_each_set_bit(j, &si->sbi->s_flag, 32)
+			seq_puts(s, s_flag[j]);
+		seq_puts(s, ") ]=====\n");
 		seq_printf(s, "[SB: 1] [CP: 2] [SIT: %d] [NAT: %d] ",
 			   si->sit_area_segs, si->nat_area_segs);
 		seq_printf(s, "[SSA: %d] [MAIN: %d",
Signature · 8 lines
2.32.0



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
maintainer
#2 lore raw

Re: [f2fs-dev] [PATCH] f2fs: improve sbi status info in debugfs/f2fs/status

Quoted 1 line · Yangtao Li

Do not use numbers but strings to improve readability.

I'm fine with this, but not sure it's what Jaeguek wants.

Quoted 11 lines
---
  fs/f2fs/debug.c | 28 +++++++++++++++++++++++-----
  1 file changed, 23 insertions(+), 5 deletions(-)
fs/f2fs/debug.c +0 -0
index 473ad04d1891..91c0910b0bb7 100644

fs/f2fs/debug.c static void update_mem_info(struct f2fs_sb_info *sbi) · line 327

Quoted 5 lines
fs/f2fs/debug.c +2 -0
@@ -323,22 +323,40 @@ static void update_mem_info(struct f2fs_sb_info *sbi)
  #endif
  }
 
+static char *s_flag[] = {
+	[SBI_IS_DIRTY]		= " dirty",

fs_dirty

fs/f2fs/debug.c static void update_mem_info(struct f2fs_sb_info *sbi) · line 328

Quoted 1 line
fs/f2fs/debug.c +1 -0
+	[SBI_IS_CLOSE]		= " close",

closing

fs/f2fs/debug.c static void update_mem_info(struct f2fs_sb_info *sbi) · line 329

Quoted 1 line
fs/f2fs/debug.c +1 -0
+	[SBI_NEED_FSCK]		= " fsck",

need_fsck

fs/f2fs/debug.c static void update_mem_info(struct f2fs_sb_info *sbi) · line 330

Quoted 1 line
fs/f2fs/debug.c +1 -0
+	[SBI_POR_DOING]		= " doing",

recovering

fs/f2fs/debug.c static void update_mem_info(struct f2fs_sb_info *sbi) · line 331

Quoted 1 line
fs/f2fs/debug.c +1 -0
+	[SBI_NEED_SB_WRITE]	= " sb_write",

sb_dirty

fs/f2fs/debug.c static void update_mem_info(struct f2fs_sb_info *sbi) · line 332

Quoted 1 line
fs/f2fs/debug.c +1 -0
+	[SBI_NEED_CP]		= " cp",

need_cp

Quoted 21 lines
fs/f2fs/debug.c +11 -2
+	[SBI_IS_SHUTDOWN]	= " shutdown",
+	[SBI_IS_RECOVERED]	= " recovered",
+	[SBI_CP_DISABLED]	= " cp_disabled",
+	[SBI_CP_DISABLED_QUICK]	= " cp_disabled_quick",
+	[SBI_QUOTA_NEED_FLUSH]	= " quota_need_flush",
+	[SBI_QUOTA_SKIP_FLUSH]	= " quota_skip_flush",
+	[SBI_QUOTA_NEED_REPAIR]	= " quota_need_repair",
+	[SBI_IS_RESIZEFS]	= " resizefs",
+};
+
  static int stat_show(struct seq_file *s, void *v)
  {
  	struct f2fs_stat_info *si;
-	int i = 0;
-	int j;
+	int i = 0, j = 0;
 
  	mutex_lock(&f2fs_stat_mutex);
  	list_for_each_entry(si, &f2fs_stat_list, stat_list) {
  		update_general_status(si->sbi);
 

fs/f2fs/debug.c static void update_mem_info(struct f2fs_sb_info *sbi) · line 358

Quoted 10 lines
fs/f2fs/debug.c +4 -3
-		seq_printf(s, "\n=====[ partition info(%pg). #%d, %s, CP: %s (sbi: 0x%lx)]=====\n",
+		seq_printf(s, "\n=====[ partition info(%pg). #%d, %s, CP: %s (sbi:",
  			si->sbi->sb->s_bdev, i++,
  			f2fs_readonly(si->sbi->sb) ? "RO": "RW",
  			is_set_ckpt_flags(si->sbi, CP_DISABLED_FLAG) ?
-			"Disabled": (f2fs_cp_error(si->sbi) ? "Error": "Good"),
-			si->sbi->s_flag);
+			"Disabled" : (f2fs_cp_error(si->sbi) ? "Error" : "Good"));
+		for_each_set_bit(j, &si->sbi->s_flag, 32)
+			seq_puts(s, s_flag[j]);

How about starting to print sb related status in a new line to avoid extreme long line.

Thanks,

Quoted 5 lines
fs/f2fs/debug.c +1 -0
+		seq_puts(s, ") ]=====\n");
  		seq_printf(s, "[SB: 1] [CP: 2] [SIT: %d] [NAT: %d] ",
  			   si->sit_area_segs, si->nat_area_segs);
  		seq_printf(s, "[SSA: %d] [MAIN: %d",