* [PATCH] f2fs: convert /sys/fs/f2fs/<disk>/stat/sb_status to use string
@ 2021-08-13 14:01 ` Yangtao Li
0 siblings, 0 replies; 12+ messages in thread
From: Yangtao Li @ 2021-08-13 14:01 UTC (permalink / raw)
To: jaegeuk, chao; +Cc: linux-f2fs-devel, linux-kernel, Yangtao Li
Do not use numbers but strings to improve readability when flag is set.
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
This patch is based on [v2] f2fs: improve sbi status info in debugfs/f2fs/status
Documentation/ABI/testing/sysfs-fs-f2fs | 34 ++++++++++++-------------
fs/f2fs/debug.c | 19 +-------------
fs/f2fs/f2fs.h | 1 +
fs/f2fs/sysfs.c | 26 ++++++++++++++++++-
4 files changed, 44 insertions(+), 36 deletions(-)
diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs
index 73211f77d11e..b07eb1e27c97 100644
--- a/Documentation/ABI/testing/sysfs-fs-f2fs
+++ b/Documentation/ABI/testing/sysfs-fs-f2fs
@@ -410,23 +410,23 @@ Date: December 2020
Contact: "Chao Yu" <yuchao0@huawei.com>
Description: Show status of f2fs superblock in real time.
- ====== ===================== =================================
- value sb status macro description
- 0x1 SBI_IS_DIRTY dirty flag for checkpoint
- 0x2 SBI_IS_CLOSE specify unmounting
- 0x4 SBI_NEED_FSCK need fsck.f2fs to fix
- 0x8 SBI_POR_DOING recovery is doing or not
- 0x10 SBI_NEED_SB_WRITE need to recover superblock
- 0x20 SBI_NEED_CP need to checkpoint
- 0x40 SBI_IS_SHUTDOWN shutdown by ioctl
- 0x80 SBI_IS_RECOVERED recovered orphan/data
- 0x100 SBI_CP_DISABLED CP was disabled last mount
- 0x200 SBI_CP_DISABLED_QUICK CP was disabled quickly
- 0x400 SBI_QUOTA_NEED_FLUSH need to flush quota info in CP
- 0x800 SBI_QUOTA_SKIP_FLUSH skip flushing quota in current CP
- 0x1000 SBI_QUOTA_NEED_REPAIR quota file may be corrupted
- 0x2000 SBI_IS_RESIZEFS resizefs is in process
- ====== ===================== =================================
+ ===================== =================================
+ sb status description
+ fs_dirty dirty flag for checkpoint
+ closing specify unmounting
+ need_fsck need fsck.f2fs to fix
+ recovering recovery is doing or not
+ sb_dirty need to recover superblock
+ need_cp need to checkpoint
+ shutdown shutdown by ioctl
+ recovered recovered orphan/data
+ cp_disabled CP was disabled last mount
+ cp_disabled_quick CP was disabled quickly
+ quota_need_flush need to flush quota info in CP
+ quota_skip_flush skip flushing quota in current CP
+ quota_need_repair quota file may be corrupted
+ resizefs resizefs is in process
+ ===================== =================================
What: /sys/fs/f2fs/<disk>/ckpt_thread_ioprio
Date: January 2021
diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c
index d8c09346545d..298bf41a13b6 100644
--- a/fs/f2fs/debug.c
+++ b/fs/f2fs/debug.c
@@ -323,23 +323,6 @@ static void update_mem_info(struct f2fs_sb_info *sbi)
#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;
@@ -357,7 +340,7 @@ static int stat_show(struct seq_file *s, void *v)
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_printf(s, " %s", s_flag[j]);
seq_puts(s, "]\n");
}
seq_printf(s, "[SB: 1] [CP: 2] [SIT: %d] [NAT: %d] ",
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 67faa43cc141..772dd3352c64 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -1257,6 +1257,7 @@ enum {
SBI_QUOTA_NEED_REPAIR, /* quota file may be corrupted */
SBI_IS_RESIZEFS, /* resizefs is in process */
};
+extern char *s_flag[];
enum {
CP_TIME,
diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
index 0954761341d7..e6f87e3d8f2e 100644
--- a/fs/f2fs/sysfs.c
+++ b/fs/f2fs/sysfs.c
@@ -111,10 +111,34 @@ static ssize_t lifetime_write_kbytes_show(struct f2fs_attr *a,
sbi->sectors_written_start) >> 1)));
}
+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 ssize_t sb_status_show(struct f2fs_attr *a,
struct f2fs_sb_info *sbi, char *buf)
{
- return sprintf(buf, "%lx\n", sbi->s_flag);
+ int len = 0, i = 0;
+
+ for_each_set_bit(i, &sbi->s_flag, 32)
+ len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
+ len ? ", " : "", s_flag[i]);
+ len += scnprintf(buf + len, PAGE_SIZE - len, "\n");
+
+ return len;
}
static ssize_t features_show(struct f2fs_attr *a,
--
2.32.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [f2fs-dev] [PATCH] f2fs: convert /sys/fs/f2fs/<disk>/stat/sb_status to use string
@ 2021-08-13 14:01 ` Yangtao Li
0 siblings, 0 replies; 12+ messages in thread
From: Yangtao Li @ 2021-08-13 14:01 UTC (permalink / raw)
To: jaegeuk, chao; +Cc: Yangtao Li, linux-kernel, linux-f2fs-devel
Do not use numbers but strings to improve readability when flag is set.
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
This patch is based on [v2] f2fs: improve sbi status info in debugfs/f2fs/status
Documentation/ABI/testing/sysfs-fs-f2fs | 34 ++++++++++++-------------
fs/f2fs/debug.c | 19 +-------------
fs/f2fs/f2fs.h | 1 +
fs/f2fs/sysfs.c | 26 ++++++++++++++++++-
4 files changed, 44 insertions(+), 36 deletions(-)
diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs
index 73211f77d11e..b07eb1e27c97 100644
--- a/Documentation/ABI/testing/sysfs-fs-f2fs
+++ b/Documentation/ABI/testing/sysfs-fs-f2fs
@@ -410,23 +410,23 @@ Date: December 2020
Contact: "Chao Yu" <yuchao0@huawei.com>
Description: Show status of f2fs superblock in real time.
- ====== ===================== =================================
- value sb status macro description
- 0x1 SBI_IS_DIRTY dirty flag for checkpoint
- 0x2 SBI_IS_CLOSE specify unmounting
- 0x4 SBI_NEED_FSCK need fsck.f2fs to fix
- 0x8 SBI_POR_DOING recovery is doing or not
- 0x10 SBI_NEED_SB_WRITE need to recover superblock
- 0x20 SBI_NEED_CP need to checkpoint
- 0x40 SBI_IS_SHUTDOWN shutdown by ioctl
- 0x80 SBI_IS_RECOVERED recovered orphan/data
- 0x100 SBI_CP_DISABLED CP was disabled last mount
- 0x200 SBI_CP_DISABLED_QUICK CP was disabled quickly
- 0x400 SBI_QUOTA_NEED_FLUSH need to flush quota info in CP
- 0x800 SBI_QUOTA_SKIP_FLUSH skip flushing quota in current CP
- 0x1000 SBI_QUOTA_NEED_REPAIR quota file may be corrupted
- 0x2000 SBI_IS_RESIZEFS resizefs is in process
- ====== ===================== =================================
+ ===================== =================================
+ sb status description
+ fs_dirty dirty flag for checkpoint
+ closing specify unmounting
+ need_fsck need fsck.f2fs to fix
+ recovering recovery is doing or not
+ sb_dirty need to recover superblock
+ need_cp need to checkpoint
+ shutdown shutdown by ioctl
+ recovered recovered orphan/data
+ cp_disabled CP was disabled last mount
+ cp_disabled_quick CP was disabled quickly
+ quota_need_flush need to flush quota info in CP
+ quota_skip_flush skip flushing quota in current CP
+ quota_need_repair quota file may be corrupted
+ resizefs resizefs is in process
+ ===================== =================================
What: /sys/fs/f2fs/<disk>/ckpt_thread_ioprio
Date: January 2021
diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c
index d8c09346545d..298bf41a13b6 100644
--- a/fs/f2fs/debug.c
+++ b/fs/f2fs/debug.c
@@ -323,23 +323,6 @@ static void update_mem_info(struct f2fs_sb_info *sbi)
#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;
@@ -357,7 +340,7 @@ static int stat_show(struct seq_file *s, void *v)
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_printf(s, " %s", s_flag[j]);
seq_puts(s, "]\n");
}
seq_printf(s, "[SB: 1] [CP: 2] [SIT: %d] [NAT: %d] ",
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 67faa43cc141..772dd3352c64 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -1257,6 +1257,7 @@ enum {
SBI_QUOTA_NEED_REPAIR, /* quota file may be corrupted */
SBI_IS_RESIZEFS, /* resizefs is in process */
};
+extern char *s_flag[];
enum {
CP_TIME,
diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
index 0954761341d7..e6f87e3d8f2e 100644
--- a/fs/f2fs/sysfs.c
+++ b/fs/f2fs/sysfs.c
@@ -111,10 +111,34 @@ static ssize_t lifetime_write_kbytes_show(struct f2fs_attr *a,
sbi->sectors_written_start) >> 1)));
}
+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 ssize_t sb_status_show(struct f2fs_attr *a,
struct f2fs_sb_info *sbi, char *buf)
{
- return sprintf(buf, "%lx\n", sbi->s_flag);
+ int len = 0, i = 0;
+
+ for_each_set_bit(i, &sbi->s_flag, 32)
+ len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
+ len ? ", " : "", s_flag[i]);
+ len += scnprintf(buf + len, PAGE_SIZE - len, "\n");
+
+ return len;
}
static ssize_t features_show(struct f2fs_attr *a,
--
2.32.0
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] f2fs: convert /sys/fs/f2fs/<disk>/stat/sb_status to use string
2021-08-13 14:01 ` [f2fs-dev] " Yangtao Li
@ 2021-08-13 14:09 ` Chao Yu
-1 siblings, 0 replies; 12+ messages in thread
From: Chao Yu @ 2021-08-13 14:09 UTC (permalink / raw)
To: Yangtao Li, jaegeuk; +Cc: linux-f2fs-devel, linux-kernel
On 2021/8/13 22:01, Yangtao Li wrote:
> Do not use numbers but strings to improve readability when flag is set.
This breaks output rule of sysfs entry, see below link:
https://www.mail-archive.com/linux-f2fs-devel@lists.sourceforge.net/msg19001.html
Thanks,
>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
> This patch is based on [v2] f2fs: improve sbi status info in debugfs/f2fs/status
>
> Documentation/ABI/testing/sysfs-fs-f2fs | 34 ++++++++++++-------------
> fs/f2fs/debug.c | 19 +-------------
> fs/f2fs/f2fs.h | 1 +
> fs/f2fs/sysfs.c | 26 ++++++++++++++++++-
> 4 files changed, 44 insertions(+), 36 deletions(-)
>
> diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs
> index 73211f77d11e..b07eb1e27c97 100644
> --- a/Documentation/ABI/testing/sysfs-fs-f2fs
> +++ b/Documentation/ABI/testing/sysfs-fs-f2fs
> @@ -410,23 +410,23 @@ Date: December 2020
> Contact: "Chao Yu" <yuchao0@huawei.com>
> Description: Show status of f2fs superblock in real time.
>
> - ====== ===================== =================================
> - value sb status macro description
> - 0x1 SBI_IS_DIRTY dirty flag for checkpoint
> - 0x2 SBI_IS_CLOSE specify unmounting
> - 0x4 SBI_NEED_FSCK need fsck.f2fs to fix
> - 0x8 SBI_POR_DOING recovery is doing or not
> - 0x10 SBI_NEED_SB_WRITE need to recover superblock
> - 0x20 SBI_NEED_CP need to checkpoint
> - 0x40 SBI_IS_SHUTDOWN shutdown by ioctl
> - 0x80 SBI_IS_RECOVERED recovered orphan/data
> - 0x100 SBI_CP_DISABLED CP was disabled last mount
> - 0x200 SBI_CP_DISABLED_QUICK CP was disabled quickly
> - 0x400 SBI_QUOTA_NEED_FLUSH need to flush quota info in CP
> - 0x800 SBI_QUOTA_SKIP_FLUSH skip flushing quota in current CP
> - 0x1000 SBI_QUOTA_NEED_REPAIR quota file may be corrupted
> - 0x2000 SBI_IS_RESIZEFS resizefs is in process
> - ====== ===================== =================================
> + ===================== =================================
> + sb status description
> + fs_dirty dirty flag for checkpoint
> + closing specify unmounting
> + need_fsck need fsck.f2fs to fix
> + recovering recovery is doing or not
> + sb_dirty need to recover superblock
> + need_cp need to checkpoint
> + shutdown shutdown by ioctl
> + recovered recovered orphan/data
> + cp_disabled CP was disabled last mount
> + cp_disabled_quick CP was disabled quickly
> + quota_need_flush need to flush quota info in CP
> + quota_skip_flush skip flushing quota in current CP
> + quota_need_repair quota file may be corrupted
> + resizefs resizefs is in process
> + ===================== =================================
>
> What: /sys/fs/f2fs/<disk>/ckpt_thread_ioprio
> Date: January 2021
> diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c
> index d8c09346545d..298bf41a13b6 100644
> --- a/fs/f2fs/debug.c
> +++ b/fs/f2fs/debug.c
> @@ -323,23 +323,6 @@ static void update_mem_info(struct f2fs_sb_info *sbi)
> #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;
> @@ -357,7 +340,7 @@ static int stat_show(struct seq_file *s, void *v)
> 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_printf(s, " %s", s_flag[j]);
> seq_puts(s, "]\n");
> }
> seq_printf(s, "[SB: 1] [CP: 2] [SIT: %d] [NAT: %d] ",
> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> index 67faa43cc141..772dd3352c64 100644
> --- a/fs/f2fs/f2fs.h
> +++ b/fs/f2fs/f2fs.h
> @@ -1257,6 +1257,7 @@ enum {
> SBI_QUOTA_NEED_REPAIR, /* quota file may be corrupted */
> SBI_IS_RESIZEFS, /* resizefs is in process */
> };
> +extern char *s_flag[];
>
> enum {
> CP_TIME,
> diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> index 0954761341d7..e6f87e3d8f2e 100644
> --- a/fs/f2fs/sysfs.c
> +++ b/fs/f2fs/sysfs.c
> @@ -111,10 +111,34 @@ static ssize_t lifetime_write_kbytes_show(struct f2fs_attr *a,
> sbi->sectors_written_start) >> 1)));
> }
>
> +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 ssize_t sb_status_show(struct f2fs_attr *a,
> struct f2fs_sb_info *sbi, char *buf)
> {
> - return sprintf(buf, "%lx\n", sbi->s_flag);
> + int len = 0, i = 0;
> +
> + for_each_set_bit(i, &sbi->s_flag, 32)
> + len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> + len ? ", " : "", s_flag[i]);
> + len += scnprintf(buf + len, PAGE_SIZE - len, "\n");
> +
> + return len;
> }
>
> static ssize_t features_show(struct f2fs_attr *a,
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs: convert /sys/fs/f2fs/<disk>/stat/sb_status to use string
@ 2021-08-13 14:09 ` Chao Yu
0 siblings, 0 replies; 12+ messages in thread
From: Chao Yu @ 2021-08-13 14:09 UTC (permalink / raw)
To: Yangtao Li, jaegeuk; +Cc: linux-kernel, linux-f2fs-devel
On 2021/8/13 22:01, Yangtao Li wrote:
> Do not use numbers but strings to improve readability when flag is set.
This breaks output rule of sysfs entry, see below link:
https://www.mail-archive.com/linux-f2fs-devel@lists.sourceforge.net/msg19001.html
Thanks,
>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
> This patch is based on [v2] f2fs: improve sbi status info in debugfs/f2fs/status
>
> Documentation/ABI/testing/sysfs-fs-f2fs | 34 ++++++++++++-------------
> fs/f2fs/debug.c | 19 +-------------
> fs/f2fs/f2fs.h | 1 +
> fs/f2fs/sysfs.c | 26 ++++++++++++++++++-
> 4 files changed, 44 insertions(+), 36 deletions(-)
>
> diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs
> index 73211f77d11e..b07eb1e27c97 100644
> --- a/Documentation/ABI/testing/sysfs-fs-f2fs
> +++ b/Documentation/ABI/testing/sysfs-fs-f2fs
> @@ -410,23 +410,23 @@ Date: December 2020
> Contact: "Chao Yu" <yuchao0@huawei.com>
> Description: Show status of f2fs superblock in real time.
>
> - ====== ===================== =================================
> - value sb status macro description
> - 0x1 SBI_IS_DIRTY dirty flag for checkpoint
> - 0x2 SBI_IS_CLOSE specify unmounting
> - 0x4 SBI_NEED_FSCK need fsck.f2fs to fix
> - 0x8 SBI_POR_DOING recovery is doing or not
> - 0x10 SBI_NEED_SB_WRITE need to recover superblock
> - 0x20 SBI_NEED_CP need to checkpoint
> - 0x40 SBI_IS_SHUTDOWN shutdown by ioctl
> - 0x80 SBI_IS_RECOVERED recovered orphan/data
> - 0x100 SBI_CP_DISABLED CP was disabled last mount
> - 0x200 SBI_CP_DISABLED_QUICK CP was disabled quickly
> - 0x400 SBI_QUOTA_NEED_FLUSH need to flush quota info in CP
> - 0x800 SBI_QUOTA_SKIP_FLUSH skip flushing quota in current CP
> - 0x1000 SBI_QUOTA_NEED_REPAIR quota file may be corrupted
> - 0x2000 SBI_IS_RESIZEFS resizefs is in process
> - ====== ===================== =================================
> + ===================== =================================
> + sb status description
> + fs_dirty dirty flag for checkpoint
> + closing specify unmounting
> + need_fsck need fsck.f2fs to fix
> + recovering recovery is doing or not
> + sb_dirty need to recover superblock
> + need_cp need to checkpoint
> + shutdown shutdown by ioctl
> + recovered recovered orphan/data
> + cp_disabled CP was disabled last mount
> + cp_disabled_quick CP was disabled quickly
> + quota_need_flush need to flush quota info in CP
> + quota_skip_flush skip flushing quota in current CP
> + quota_need_repair quota file may be corrupted
> + resizefs resizefs is in process
> + ===================== =================================
>
> What: /sys/fs/f2fs/<disk>/ckpt_thread_ioprio
> Date: January 2021
> diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c
> index d8c09346545d..298bf41a13b6 100644
> --- a/fs/f2fs/debug.c
> +++ b/fs/f2fs/debug.c
> @@ -323,23 +323,6 @@ static void update_mem_info(struct f2fs_sb_info *sbi)
> #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;
> @@ -357,7 +340,7 @@ static int stat_show(struct seq_file *s, void *v)
> 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_printf(s, " %s", s_flag[j]);
> seq_puts(s, "]\n");
> }
> seq_printf(s, "[SB: 1] [CP: 2] [SIT: %d] [NAT: %d] ",
> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> index 67faa43cc141..772dd3352c64 100644
> --- a/fs/f2fs/f2fs.h
> +++ b/fs/f2fs/f2fs.h
> @@ -1257,6 +1257,7 @@ enum {
> SBI_QUOTA_NEED_REPAIR, /* quota file may be corrupted */
> SBI_IS_RESIZEFS, /* resizefs is in process */
> };
> +extern char *s_flag[];
>
> enum {
> CP_TIME,
> diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> index 0954761341d7..e6f87e3d8f2e 100644
> --- a/fs/f2fs/sysfs.c
> +++ b/fs/f2fs/sysfs.c
> @@ -111,10 +111,34 @@ static ssize_t lifetime_write_kbytes_show(struct f2fs_attr *a,
> sbi->sectors_written_start) >> 1)));
> }
>
> +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 ssize_t sb_status_show(struct f2fs_attr *a,
> struct f2fs_sb_info *sbi, char *buf)
> {
> - return sprintf(buf, "%lx\n", sbi->s_flag);
> + int len = 0, i = 0;
> +
> + for_each_set_bit(i, &sbi->s_flag, 32)
> + len += scnprintf(buf + len, PAGE_SIZE - len, "%s%s",
> + len ? ", " : "", s_flag[i]);
> + len += scnprintf(buf + len, PAGE_SIZE - len, "\n");
> +
> + return len;
> }
>
> static ssize_t features_show(struct f2fs_attr *a,
>
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re:Re: [PATCH] f2fs: convert /sys/fs/f2fs/<disk>/stat/sb_status to use string
2021-08-13 14:09 ` [f2fs-dev] " Chao Yu
@ 2021-08-13 14:17 ` 李扬韬
-1 siblings, 0 replies; 12+ messages in thread
From: 李扬韬 @ 2021-08-13 14:17 UTC (permalink / raw)
To: Chao Yu; +Cc: jaegeuk, linux-f2fs-devel, linux-kernel
HI Chao,
From: Chao Yu <chao@kernel.org>
Date: 2021-08-13 22:09:53
To: Yangtao Li <frank.li@vivo.com>,jaegeuk@kernel.org
Cc: linux-f2fs-devel@lists.sourceforge.net,linux-kernel@vger.kernel.org
Subject: Re: [PATCH] f2fs: convert /sys/fs/f2fs/<disk>/stat/sb_status to use string>On 2021/8/13 22:01, Yangtao Li wrote:
>> Do not use numbers but strings to improve readability when flag is set.
>
>This breaks output rule of sysfs entry, see below link:
>
Which rule? one entry should show one value?
But I see that:
# cat /sys/fs/f2fs/<disk>/features
encryption, quota_ino, verity, pin_file
So the format of features also wrong?
Thx,
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs: convert /sys/fs/f2fs/<disk>/stat/sb_status to use string
@ 2021-08-13 14:17 ` 李扬韬
0 siblings, 0 replies; 12+ messages in thread
From: 李扬韬 @ 2021-08-13 14:17 UTC (permalink / raw)
To: Chao Yu; +Cc: jaegeuk, linux-kernel, linux-f2fs-devel
HI Chao,
From: Chao Yu <chao@kernel.org>
Date: 2021-08-13 22:09:53
To: Yangtao Li <frank.li@vivo.com>,jaegeuk@kernel.org
Cc: linux-f2fs-devel@lists.sourceforge.net,linux-kernel@vger.kernel.org
Subject: Re: [PATCH] f2fs: convert /sys/fs/f2fs/<disk>/stat/sb_status to use string>On 2021/8/13 22:01, Yangtao Li wrote:
>> Do not use numbers but strings to improve readability when flag is set.
>
>This breaks output rule of sysfs entry, see below link:
>
Which rule? one entry should show one value?
But I see that:
# cat /sys/fs/f2fs/<disk>/features
encryption, quota_ino, verity, pin_file
So the format of features also wrong?
Thx,
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] f2fs: convert /sys/fs/f2fs/<disk>/stat/sb_status to use string
2021-08-13 14:17 ` [f2fs-dev] " 李扬韬
@ 2021-08-13 14:41 ` Chao Yu
-1 siblings, 0 replies; 12+ messages in thread
From: Chao Yu @ 2021-08-13 14:41 UTC (permalink / raw)
To: 李扬韬; +Cc: jaegeuk, linux-f2fs-devel, linux-kernel
On 2021/8/13 22:17, 李扬韬 wrote:
> HI Chao,
>
> From: Chao Yu <chao@kernel.org>
> Date: 2021-08-13 22:09:53
> To: Yangtao Li <frank.li@vivo.com>,jaegeuk@kernel.org
> Cc: linux-f2fs-devel@lists.sourceforge.net,linux-kernel@vger.kernel.org
> Subject: Re: [PATCH] f2fs: convert /sys/fs/f2fs/<disk>/stat/sb_status to use string>On 2021/8/13 22:01, Yangtao Li wrote:
>>> Do not use numbers but strings to improve readability when flag is set.
>>
>> This breaks output rule of sysfs entry, see below link:
>>
> Which rule? one entry should show one value?
Yes, one value per file please, which is suggested by Greg.
https://lkml.org/lkml/2021/6/3/319
>
> But I see that:
> # cat /sys/fs/f2fs/<disk>/features
> encryption, quota_ino, verity, pin_file
>
> So the format of features also wrong?
What: /sys/fs/f2fs/<disk>/features
Date: July 2017
Contact: "Jaegeuk Kim" <jaegeuk@kernel.org>
Description: <deprecated: should use /sys/fs/f2fs/<disk>/feature_list/
Thanks,
>
> Thx,
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs: convert /sys/fs/f2fs/<disk>/stat/sb_status to use string
@ 2021-08-13 14:41 ` Chao Yu
0 siblings, 0 replies; 12+ messages in thread
From: Chao Yu @ 2021-08-13 14:41 UTC (permalink / raw)
To: 李扬韬; +Cc: jaegeuk, linux-kernel, linux-f2fs-devel
On 2021/8/13 22:17, 李扬韬 wrote:
> HI Chao,
>
> From: Chao Yu <chao@kernel.org>
> Date: 2021-08-13 22:09:53
> To: Yangtao Li <frank.li@vivo.com>,jaegeuk@kernel.org
> Cc: linux-f2fs-devel@lists.sourceforge.net,linux-kernel@vger.kernel.org
> Subject: Re: [PATCH] f2fs: convert /sys/fs/f2fs/<disk>/stat/sb_status to use string>On 2021/8/13 22:01, Yangtao Li wrote:
>>> Do not use numbers but strings to improve readability when flag is set.
>>
>> This breaks output rule of sysfs entry, see below link:
>>
> Which rule? one entry should show one value?
Yes, one value per file please, which is suggested by Greg.
https://lkml.org/lkml/2021/6/3/319
>
> But I see that:
> # cat /sys/fs/f2fs/<disk>/features
> encryption, quota_ino, verity, pin_file
>
> So the format of features also wrong?
What: /sys/fs/f2fs/<disk>/features
Date: July 2017
Contact: "Jaegeuk Kim" <jaegeuk@kernel.org>
Description: <deprecated: should use /sys/fs/f2fs/<disk>/feature_list/
Thanks,
>
> Thx,
>
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re:Re: [PATCH] f2fs: convert /sys/fs/f2fs/<disk>/stat/sb_status to use string
2021-08-13 14:41 ` [f2fs-dev] " Chao Yu
@ 2021-08-13 14:55 ` 李扬韬
-1 siblings, 0 replies; 12+ messages in thread
From: 李扬韬 @ 2021-08-13 14:55 UTC (permalink / raw)
To: Chao Yu; +Cc: jaegeuk, linux-f2fs-devel, linux-kernel
发件人:Chao Yu <chao@kernel.org>
发送日期:2021-08-13 22:41:02
收件人:"李扬韬" <frank.li@vivo.com>
抄送人:jaegeuk@kernel.org,linux-f2fs-devel@lists.sourceforge.net,linux-kernel@vger.kernel.org
主题:Re: [PATCH] f2fs: convert /sys/fs/f2fs/<disk>/stat/sb_status to use string>On 2021/8/13 22:17, 李扬韬 wrote:
>> HI Chao,
>>
>> From: Chao Yu <chao@kernel.org>
>> Date: 2021-08-13 22:09:53
>> To: Yangtao Li <frank.li@vivo.com>,jaegeuk@kernel.org
>> Cc: linux-f2fs-devel@lists.sourceforge.net,linux-kernel@vger.kernel.org
>> Subject: Re: [PATCH] f2fs: convert /sys/fs/f2fs/<disk>/stat/sb_status to use string>On 2021/8/13 22:01, Yangtao Li wrote:
>>>> Do not use numbers but strings to improve readability when flag is set.
>>>
>>> This breaks output rule of sysfs entry, see below link:
>>>
>> Which rule? one entry should show one value?
>
>Yes, one value per file please, which is suggested by Greg.
>
>https://lkml.org/lkml/2021/6/3/319
>
>>
>> But I see that:
>> # cat /sys/fs/f2fs/<disk>/features
>> encryption, quota_ino, verity, pin_file
>>
>> So the format of features also wrong?
>
> What: /sys/fs/f2fs/<disk>/features
> Date: July 2017
> Contact: "Jaegeuk Kim" <jaegeuk@kernel.org>
> Description: <deprecated: should use /sys/fs/f2fs/<disk>/feature_list/
OK, So Maybe we can make something like following?
/sys/fs/f2fs/<disk>/sbi_status/fsck
Yangtao
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs: convert /sys/fs/f2fs/<disk>/stat/sb_status to use string
@ 2021-08-13 14:55 ` 李扬韬
0 siblings, 0 replies; 12+ messages in thread
From: 李扬韬 @ 2021-08-13 14:55 UTC (permalink / raw)
To: Chao Yu; +Cc: jaegeuk, linux-kernel, linux-f2fs-devel
发件人:Chao Yu <chao@kernel.org>
发送日期:2021-08-13 22:41:02
收件人:"李扬韬" <frank.li@vivo.com>
抄送人:jaegeuk@kernel.org,linux-f2fs-devel@lists.sourceforge.net,linux-kernel@vger.kernel.org
主题:Re: [PATCH] f2fs: convert /sys/fs/f2fs/<disk>/stat/sb_status to use string>On 2021/8/13 22:17, 李扬韬 wrote:
>> HI Chao,
>>
>> From: Chao Yu <chao@kernel.org>
>> Date: 2021-08-13 22:09:53
>> To: Yangtao Li <frank.li@vivo.com>,jaegeuk@kernel.org
>> Cc: linux-f2fs-devel@lists.sourceforge.net,linux-kernel@vger.kernel.org
>> Subject: Re: [PATCH] f2fs: convert /sys/fs/f2fs/<disk>/stat/sb_status to use string>On 2021/8/13 22:01, Yangtao Li wrote:
>>>> Do not use numbers but strings to improve readability when flag is set.
>>>
>>> This breaks output rule of sysfs entry, see below link:
>>>
>> Which rule? one entry should show one value?
>
>Yes, one value per file please, which is suggested by Greg.
>
>https://lkml.org/lkml/2021/6/3/319
>
>>
>> But I see that:
>> # cat /sys/fs/f2fs/<disk>/features
>> encryption, quota_ino, verity, pin_file
>>
>> So the format of features also wrong?
>
> What: /sys/fs/f2fs/<disk>/features
> Date: July 2017
> Contact: "Jaegeuk Kim" <jaegeuk@kernel.org>
> Description: <deprecated: should use /sys/fs/f2fs/<disk>/feature_list/
OK, So Maybe we can make something like following?
/sys/fs/f2fs/<disk>/sbi_status/fsck
Yangtao
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re:Re: [PATCH] f2fs: convert /sys/fs/f2fs/<disk>/stat/sb_status to use string
2021-08-13 14:41 ` [f2fs-dev] " Chao Yu
@ 2021-08-14 2:41 ` 李扬韬
-1 siblings, 0 replies; 12+ messages in thread
From: 李扬韬 @ 2021-08-14 2:41 UTC (permalink / raw)
To: Chao Yu; +Cc: jaegeuk, linux-f2fs-devel, linux-kernel
>> HI Chao,
>>
>> From: Chao Yu <chao@kernel.org>
>> Date: 2021-08-13 22:09:53
>> To: Yangtao Li <frank.li@vivo.com>,jaegeuk@kernel.org
>> Cc: linux-f2fs-devel@lists.sourceforge.net,linux-kernel@vger.kernel.org
>> Subject: Re: [PATCH] f2fs: convert /sys/fs/f2fs/<disk>/stat/sb_status to use string>On 2021/8/13 22:01, Yangtao Li wrote:
>>>> Do not use numbers but strings to improve readability when flag is set.
>>>
>>> This breaks output rule of sysfs entry, see below link:
>>>
>> Which rule? one entry should show one value?
>
>Yes, one value per file please, which is suggested by Greg.
>
>https://lkml.org/lkml/2021/6/3/319
>
>>
>> But I see that:
>> # cat /sys/fs/f2fs/<disk>/features
>> encryption, quota_ino, verity, pin_file
>>
>> So the format of features also wrong?
>
> What: /sys/fs/f2fs/<disk>/features
> Date: July 2017
> Contact: "Jaegeuk Kim" <jaegeuk@kernel.org>
> Description: <deprecated: should use /sys/fs/f2fs/<disk>/feature_list/
root@kvm-xfstests:~# cat /sys/fs/f2fs/nvme0n1/extension_list
cold file extension:
jpg
gif
png
avi
divx
mp4
mp3
3gp
wmv
wma
mpeg
mkv
mov
asx
asf
wmx
svi
wvx
wm
mpg
mpe
rm
ogg
jpeg
video
apk
so
hot file extension:
db
So we need remove extension_list to proc fs?
MBR,
Yangtao
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs: convert /sys/fs/f2fs/<disk>/stat/sb_status to use string
@ 2021-08-14 2:41 ` 李扬韬
0 siblings, 0 replies; 12+ messages in thread
From: 李扬韬 @ 2021-08-14 2:41 UTC (permalink / raw)
To: Chao Yu; +Cc: jaegeuk, linux-kernel, linux-f2fs-devel
>> HI Chao,
>>
>> From: Chao Yu <chao@kernel.org>
>> Date: 2021-08-13 22:09:53
>> To: Yangtao Li <frank.li@vivo.com>,jaegeuk@kernel.org
>> Cc: linux-f2fs-devel@lists.sourceforge.net,linux-kernel@vger.kernel.org
>> Subject: Re: [PATCH] f2fs: convert /sys/fs/f2fs/<disk>/stat/sb_status to use string>On 2021/8/13 22:01, Yangtao Li wrote:
>>>> Do not use numbers but strings to improve readability when flag is set.
>>>
>>> This breaks output rule of sysfs entry, see below link:
>>>
>> Which rule? one entry should show one value?
>
>Yes, one value per file please, which is suggested by Greg.
>
>https://lkml.org/lkml/2021/6/3/319
>
>>
>> But I see that:
>> # cat /sys/fs/f2fs/<disk>/features
>> encryption, quota_ino, verity, pin_file
>>
>> So the format of features also wrong?
>
> What: /sys/fs/f2fs/<disk>/features
> Date: July 2017
> Contact: "Jaegeuk Kim" <jaegeuk@kernel.org>
> Description: <deprecated: should use /sys/fs/f2fs/<disk>/feature_list/
root@kvm-xfstests:~# cat /sys/fs/f2fs/nvme0n1/extension_list
cold file extension:
jpg
gif
png
avi
divx
mp4
mp3
3gp
wmv
wma
mpeg
mkv
mov
asx
asf
wmx
svi
wvx
wm
mpg
mpe
rm
ogg
jpeg
video
apk
so
hot file extension:
db
So we need remove extension_list to proc fs?
MBR,
Yangtao
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2021-08-14 2:44 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-13 14:01 [PATCH] f2fs: convert /sys/fs/f2fs/<disk>/stat/sb_status to use string Yangtao Li
2021-08-13 14:01 ` [f2fs-dev] " Yangtao Li
2021-08-13 14:09 ` Chao Yu
2021-08-13 14:09 ` [f2fs-dev] " Chao Yu
2021-08-13 14:17 ` 李扬韬
2021-08-13 14:17 ` [f2fs-dev] " 李扬韬
2021-08-13 14:41 ` Chao Yu
2021-08-13 14:41 ` [f2fs-dev] " Chao Yu
2021-08-13 14:55 ` 李扬韬
2021-08-13 14:55 ` [f2fs-dev] " 李扬韬
2021-08-14 2:41 ` 李扬韬
2021-08-14 2:41 ` [f2fs-dev] " 李扬韬
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.