mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] f2fs: including waf data in f2fs status information
       [not found] <CGME20230602044830epcms2p141ec782e866c2adc5a3142516f051b87@epcms2p3>
@ 2023-06-16  4:37 ` beomsu kim
  0 siblings, 0 replies; 2+ messages in thread
From: beomsu kim @ 2023-06-16  4:37 UTC (permalink / raw)
  To: Chao Yu, jaegeuk, linux-f2fs-devel, linux-kernel
  Cc: Yonggil Song, Seokhwan Kim, Daejun Park, Seonghun Kim

When evaluating in f2fs, it takes much time to obtain waf data.
This patch helps to obtain waf data without calcluation.

Signed-off-by: Beomsu Kim <beomsu7.kim@samsung.com>
---
 fs/f2fs/iostat.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/fs/f2fs/iostat.c b/fs/f2fs/iostat.c
index 3d5bfb1ad585..59720639e8c0 100644
--- a/fs/f2fs/iostat.c
+++ b/fs/f2fs/iostat.c
@@ -34,10 +34,23 @@ int __maybe_unused iostat_info_seq_show(struct seq_file *seq, void *offset)
 {
        struct super_block *sb = seq->private;
        struct f2fs_sb_info *sbi = F2FS_SB(sb);
+       int j;
+       unsigned long long waf = 0;
+       unsigned long long data_written_by_user;
+       unsigned long long data_written_to_storage;
 
        if (!sbi->iostat_enable)
                return 0;
 
+       data_written_by_user = sbi->iostat_bytes[FS_DATA_IO];
+
+       data_written_to_storage = data_written_by_user;
+       for (j = FS_NODE_IO; j <= FS_CP_META_IO; j++)
+               data_written_to_storage += sbi->iostat_bytes[j];
+
+       if (data_written_by_user > 0)
+               waf = data_written_to_storage * 100 / data_written_by_user;
+
        seq_printf(seq, "time:          %-16llu\n", ktime_get_real_seconds());
        seq_printf(seq, "\t\t\t%-16s %-16s %-16s\n",
                                "io_bytes", "count", "avg_bytes");
@@ -81,6 +94,10 @@ int __maybe_unused iostat_info_seq_show(struct seq_file *seq, void *offset)
        IOSTAT_INFO_SHOW("fs discard", FS_DISCARD_IO);
        IOSTAT_INFO_SHOW("fs flush", FS_FLUSH_IO);
 
+       /* print waf */
+       seq_puts(seq, "[WAF]\n");
+       seq_printf(seq, "fs waf:                %llu.%02llu\n", waf / 100, waf % 100);
+
        return 0;
 }
 
-- 
2.17.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH v2] f2fs: including waf data in f2fs status information
       [not found] <CGME20230705070944epcms2p19fc974208a2a1871e2c84df7d9d95761@epcms2p1>
@ 2023-07-05  7:09 ` beomsu kim
  0 siblings, 0 replies; 2+ messages in thread
From: beomsu kim @ 2023-07-05  7:09 UTC (permalink / raw)
  To: jaegeuk, chao, linux-f2fs-devel, linux-kernel, Yonggil Song,
	Seokhwan Kim, Daejun Park, Seonghun Kim

When evaluating in f2fs, it takes much time to obtain waf data.
This patch helps to obtain waf data without calcluation.

Signed-off-by: Beomsu Kim <beomsu7.kim@samsung.com>
---
 fs/f2fs/iostat.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/fs/f2fs/iostat.c b/fs/f2fs/iostat.c
index 3d5bfb1ad585..59720639e8c0 100644
--- a/fs/f2fs/iostat.c
+++ b/fs/f2fs/iostat.c
@@ -34,10 +34,23 @@ int __maybe_unused iostat_info_seq_show(struct seq_file *seq, void *offset)
 {
        struct super_block *sb = seq->private;
        struct f2fs_sb_info *sbi = F2FS_SB(sb);
+       int j;
+       unsigned long long waf = 0;
+       unsigned long long data_written_by_user;
+       unsigned long long data_written_to_storage;
 
        if (!sbi->iostat_enable)
                return 0;
 
+       data_written_by_user = sbi->iostat_bytes[FS_DATA_IO];
+
+       data_written_to_storage = data_written_by_user;
+       for (j = FS_NODE_IO; j <= FS_CP_META_IO; j++)
+               data_written_to_storage += sbi->iostat_bytes[j];
+
+       if (data_written_by_user > 0)
+               waf = data_written_to_storage * 100 / data_written_by_user;
+
        seq_printf(seq, "time:          %-16llu\n", ktime_get_real_seconds());
        seq_printf(seq, "\t\t\t%-16s %-16s %-16s\n",
                                "io_bytes", "count", "avg_bytes");
@@ -81,6 +94,10 @@ int __maybe_unused iostat_info_seq_show(struct seq_file *seq, void *offset)
        IOSTAT_INFO_SHOW("fs discard", FS_DISCARD_IO);
        IOSTAT_INFO_SHOW("fs flush", FS_FLUSH_IO);
 
+       /* print waf */
+       seq_puts(seq, "[WAF]\n");
+       seq_printf(seq, "fs waf:                %llu.%02llu\n", waf / 100, waf % 100);
+
        return 0;
 }
 
-- 
2.17.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-07-05  7:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20230602044830epcms2p141ec782e866c2adc5a3142516f051b87@epcms2p3>
2023-06-16  4:37 ` [PATCH v2] f2fs: including waf data in f2fs status information beomsu kim
     [not found] <CGME20230705070944epcms2p19fc974208a2a1871e2c84df7d9d95761@epcms2p1>
2023-07-05  7:09 ` beomsu kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®