[PATCH 2/4] f2fs: no need to call ktime_get_real_seconds() if iostat is not enabled

From: Yangtao Li
Date: Wed Jan 04 2023 - 06:22:36 EST


When the iostat is not enabled, it is meaningless to call
ktime_get_real_seconds() to assign values to variables.

Let's put the call to the ktime_get_real_seconds() after iostat is enabled.

Signed-off-by: Yangtao Li <frank.li@xxxxxxxx>
---
fs/f2fs/iostat.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/f2fs/iostat.c b/fs/f2fs/iostat.c
index 8460989e9bab..e7d03c446994 100644
--- a/fs/f2fs/iostat.c
+++ b/fs/f2fs/iostat.c
@@ -29,12 +29,11 @@ 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);
- time64_t now = ktime_get_real_seconds();

if (!sbi->iostat_enable)
return 0;

- seq_printf(seq, "time: %-16llu\n", now);
+ 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");

--
2.25.1