Merge tag 'pwm/for-5.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry...
[linux-2.6-microblaze.git] / fs / f2fs / debug.c
index 8333250..8c50518 100644 (file)
@@ -323,11 +323,27 @@ get_cache:
 #endif
 }
 
+static char *s_flag[] = {
+       [SBI_IS_DIRTY]          = " fs_dirty",
+       [SBI_IS_CLOSE]          = " closing",
+       [SBI_NEED_FSCK]         = " need_fsck",
+       [SBI_POR_DOING]         = " recovering",
+       [SBI_NEED_SB_WRITE]     = " sb_dirty",
+       [SBI_NEED_CP]           = " need_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) {
@@ -337,7 +353,13 @@ static int stat_show(struct seq_file *s, void *v)
                        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"));
+                       "Disabled" : (f2fs_cp_error(si->sbi) ? "Error" : "Good"));
+               if (si->sbi->s_flag) {
+                       seq_puts(s, "[SBI:");
+                       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",
@@ -450,6 +472,15 @@ static int stat_show(struct seq_file *s, void *v)
                                si->data_segs, si->bg_data_segs);
                seq_printf(s, "  - node segments : %d (%d)\n",
                                si->node_segs, si->bg_node_segs);
+               seq_printf(s, "  - Reclaimed segs : Normal (%d), Idle CB (%d), "
+                               "Idle Greedy (%d), Idle AT (%d), "
+                               "Urgent High (%d), Urgent Low (%d)\n",
+                               si->sbi->gc_reclaimed_segs[GC_NORMAL],
+                               si->sbi->gc_reclaimed_segs[GC_IDLE_CB],
+                               si->sbi->gc_reclaimed_segs[GC_IDLE_GREEDY],
+                               si->sbi->gc_reclaimed_segs[GC_IDLE_AT],
+                               si->sbi->gc_reclaimed_segs[GC_URGENT_HIGH],
+                               si->sbi->gc_reclaimed_segs[GC_URGENT_LOW]);
                seq_printf(s, "Try to move %d blocks (BG: %d)\n", si->tot_blks,
                                si->bg_data_blks + si->bg_node_blks);
                seq_printf(s, "  - data blocks : %d (%d)\n", si->data_blks,
@@ -611,7 +642,7 @@ void __init f2fs_create_root_stats(void)
 #ifdef CONFIG_DEBUG_FS
        f2fs_debugfs_root = debugfs_create_dir("f2fs", NULL);
 
-       debugfs_create_file("status", S_IRUGO, f2fs_debugfs_root, NULL,
+       debugfs_create_file("status", 0444, f2fs_debugfs_root, NULL,
                            &stat_fops);
 #endif
 }