Commit 5bb9c111 authored by Yangtao Li's avatar Yangtao Li Committed by Jaegeuk Kim

f2fs: convert to MAX_SBI_FLAG instead of 32 in stat_show()

BIW reduce the s_flag array size and make s_flag constant.
Signed-off-by: default avatarYangtao Li <frank.li@vivo.com>
Reviewed-by: default avatarChao Yu <chao@kernel.org>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 6797ebc4
...@@ -336,22 +336,22 @@ static void update_mem_info(struct f2fs_sb_info *sbi) ...@@ -336,22 +336,22 @@ static void update_mem_info(struct f2fs_sb_info *sbi)
#endif #endif
} }
static char *s_flag[] = { static const char *s_flag[MAX_SBI_FLAG] = {
[SBI_IS_DIRTY] = " fs_dirty", [SBI_IS_DIRTY] = "fs_dirty",
[SBI_IS_CLOSE] = " closing", [SBI_IS_CLOSE] = "closing",
[SBI_NEED_FSCK] = " need_fsck", [SBI_NEED_FSCK] = "need_fsck",
[SBI_POR_DOING] = " recovering", [SBI_POR_DOING] = "recovering",
[SBI_NEED_SB_WRITE] = " sb_dirty", [SBI_NEED_SB_WRITE] = "sb_dirty",
[SBI_NEED_CP] = " need_cp", [SBI_NEED_CP] = "need_cp",
[SBI_IS_SHUTDOWN] = " shutdown", [SBI_IS_SHUTDOWN] = "shutdown",
[SBI_IS_RECOVERED] = " recovered", [SBI_IS_RECOVERED] = "recovered",
[SBI_CP_DISABLED] = " cp_disabled", [SBI_CP_DISABLED] = "cp_disabled",
[SBI_CP_DISABLED_QUICK] = " cp_disabled_quick", [SBI_CP_DISABLED_QUICK] = "cp_disabled_quick",
[SBI_QUOTA_NEED_FLUSH] = " quota_need_flush", [SBI_QUOTA_NEED_FLUSH] = "quota_need_flush",
[SBI_QUOTA_SKIP_FLUSH] = " quota_skip_flush", [SBI_QUOTA_SKIP_FLUSH] = "quota_skip_flush",
[SBI_QUOTA_NEED_REPAIR] = " quota_need_repair", [SBI_QUOTA_NEED_REPAIR] = "quota_need_repair",
[SBI_IS_RESIZEFS] = " resizefs", [SBI_IS_RESIZEFS] = "resizefs",
[SBI_IS_FREEZING] = " freezefs", [SBI_IS_FREEZING] = "freezefs",
}; };
static const char *ipu_mode_names[F2FS_IPU_MAX] = { static const char *ipu_mode_names[F2FS_IPU_MAX] = {
...@@ -384,8 +384,8 @@ static int stat_show(struct seq_file *s, void *v) ...@@ -384,8 +384,8 @@ static int stat_show(struct seq_file *s, void *v)
"Disabled" : (f2fs_cp_error(sbi) ? "Error" : "Good")); "Disabled" : (f2fs_cp_error(sbi) ? "Error" : "Good"));
if (sbi->s_flag) { if (sbi->s_flag) {
seq_puts(s, "[SBI:"); seq_puts(s, "[SBI:");
for_each_set_bit(j, &sbi->s_flag, 32) for_each_set_bit(j, &sbi->s_flag, MAX_SBI_FLAG)
seq_puts(s, s_flag[j]); seq_printf(s, " %s", s_flag[j]);
seq_puts(s, "]\n"); seq_puts(s, "]\n");
} }
seq_printf(s, "[SB: 1] [CP: 2] [SIT: %d] [NAT: %d] ", seq_printf(s, "[SB: 1] [CP: 2] [SIT: %d] [NAT: %d] ",
......
...@@ -1274,7 +1274,10 @@ struct f2fs_gc_control { ...@@ -1274,7 +1274,10 @@ struct f2fs_gc_control {
unsigned int nr_free_secs; /* # of free sections to do GC */ unsigned int nr_free_secs; /* # of free sections to do GC */
}; };
/* For s_flag in struct f2fs_sb_info */ /*
* For s_flag in struct f2fs_sb_info
* Modification on enum should be synchronized with s_flag array
*/
enum { enum {
SBI_IS_DIRTY, /* dirty flag for checkpoint */ SBI_IS_DIRTY, /* dirty flag for checkpoint */
SBI_IS_CLOSE, /* specify unmounting */ SBI_IS_CLOSE, /* specify unmounting */
...@@ -1291,6 +1294,7 @@ enum { ...@@ -1291,6 +1294,7 @@ enum {
SBI_QUOTA_NEED_REPAIR, /* quota file may be corrupted */ SBI_QUOTA_NEED_REPAIR, /* quota file may be corrupted */
SBI_IS_RESIZEFS, /* resizefs is in process */ SBI_IS_RESIZEFS, /* resizefs is in process */
SBI_IS_FREEZING, /* freezefs is in process */ SBI_IS_FREEZING, /* freezefs is in process */
MAX_SBI_FLAG,
}; };
enum { enum {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment