diff mbox series

[f2fs-dev] f2fs: including waf data in f2fs status information

Message ID 20230602044830epcms2p141ec782e866c2adc5a3142516f051b87@epcms2p1 (mailing list archive)
State Superseded
Headers show
Series [f2fs-dev] f2fs: including waf data in f2fs status information | expand

Commit Message

beomsu kim June 2, 2023, 4:48 a.m. UTC
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 | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Comments

Chao Yu June 2, 2023, 8:52 a.m. UTC | #1
On 2023/6/2 12:48, beomsu kim wrote:
> 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 | 16 ++++++++++++++++
>   1 file changed, 16 insertions(+)
> 
> diff --git a/fs/f2fs/iostat.c b/fs/f2fs/iostat.c
> index 3d5bfb1ad585..6eab11b0610d 100644
> --- a/fs/f2fs/iostat.c
> +++ b/fs/f2fs/iostat.c
> @@ -34,10 +34,22 @@ 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_to_storage = 0;
> +       unsigned long long data_written_by_user = 0;
>   
>          if (!sbi->iostat_enable)
>                  return 0;
>   
> +       for (j = FS_DATA_IO; j <= FS_CP_META_IO; j++)

FS_CDATA_IO is redundant?

> +               data_written_to_storage += sbi->iostat_bytes[j];
> +       for (j = FS_DATA_IO; j <= FS_CDATA_IO; j++)

Just needs to include APP_WRITE_IO and APP_MAPPED_IO?

Thanks,

> +               data_written_by_user += 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 +93,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;
>   }
>
beomsu kim June 12, 2023, 7:52 a.m. UTC | #2
On 2023/6/2 12:48, beomsu kim wrote:
>> 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 | 16 ++++++++++++++++
>>   1 file changed, 16 insertions(+)
>> 
>> diff --git a/fs/f2fs/iostat.c b/fs/f2fs/iostat.c
>> index 3d5bfb1ad585..6eab11b0610d 100644
>> --- a/fs/f2fs/iostat.c
>> +++ b/fs/f2fs/iostat.c
>> @@ -34,10 +34,22 @@ 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_to_storage = 0;
>> +       unsigned long long data_written_by_user = 0;
>>   
>>          if (!sbi->iostat_enable)
>>                  return 0;
>>   
>> +       for (j = FS_DATA_IO; j <= FS_CP_META_IO; j++)
>
>FS_CDATA_IO is redundant?

I agree, and modified it.
		
>
>> +               data_written_to_storage += sbi->iostat_bytes[j];
>> +       for (j = FS_DATA_IO; j <= FS_CDATA_IO; j++)
>
>Just needs to include APP_WRITE_IO and APP_MAPPED_IO?

There is a slight time interval between requests in the form of APP_*_IO until they become requests in the form of FS_*_IO. On the other hand, we get the amount of file system meta data from FS_*_IO for 'data_written_to_storage'. So, If we use APP_*_IO for 'data_written_by_user', the 'waf' value returned during this time interval might have some difference from the actual value.

>
>Thanks,
>
>> +               data_written_by_user += 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 +93,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;
>>   }
>>
diff mbox series

Patch

diff --git a/fs/f2fs/iostat.c b/fs/f2fs/iostat.c
index 3d5bfb1ad585..6eab11b0610d 100644
--- a/fs/f2fs/iostat.c
+++ b/fs/f2fs/iostat.c
@@ -34,10 +34,22 @@  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_to_storage = 0;
+       unsigned long long data_written_by_user = 0;
 
        if (!sbi->iostat_enable)
                return 0;
 
+       for (j = FS_DATA_IO; j <= FS_CP_META_IO; j++)
+               data_written_to_storage += sbi->iostat_bytes[j];
+       for (j = FS_DATA_IO; j <= FS_CDATA_IO; j++)
+               data_written_by_user += 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 +93,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;
 }