[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20221221192001.17290-1-frank.li@vivo.com>
Date: Thu, 22 Dec 2022 03:20:01 +0800
From: Yangtao Li <frank.li@...o.com>
To: jaegeuk@...nel.org, chao@...nel.org
Cc: linux-f2fs-devel@...ts.sourceforge.net,
linux-kernel@...r.kernel.org, Yangtao Li <frank.li@...o.com>
Subject: [PATCH 2/2] f2fs: add iostat support for flush
In this patch, it adds to account flush count.
Signed-off-by: Yangtao Li <frank.li@...o.com>
---
fs/f2fs/f2fs.h | 1 +
fs/f2fs/iostat.c | 4 ++++
fs/f2fs/segment.c | 2 ++
3 files changed, 7 insertions(+)
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index b116c778fce6..7d7b96d1e1d2 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -1194,6 +1194,7 @@ enum iostat_type {
/* other */
FS_DISCARD, /* discard */
+ FS_FLUSH, /* flush */
NR_IO_TYPE,
};
diff --git a/fs/f2fs/iostat.c b/fs/f2fs/iostat.c
index 3d4503fef183..721294c40399 100644
--- a/fs/f2fs/iostat.c
+++ b/fs/f2fs/iostat.c
@@ -150,6 +150,10 @@ int __maybe_unused iostat_info_seq_show(struct seq_file *seq, void *offset)
sbi->rw_iostat[FS_DISCARD],
sbi->iostat_count[FS_DISCARD],
iostat_get_avg_bytes(sbi, FS_DISCARD));
+ seq_printf(seq, "fs flush: %-16llu %-16llu %-16llu\n",
+ sbi->rw_iostat[FS_FLUSH],
+ sbi->iostat_count[FS_FLUSH],
+ iostat_get_avg_bytes(sbi, FS_FLUSH));
return 0;
}
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index af2d522b1a89..ec4ed7603d1f 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -505,6 +505,8 @@ static int __submit_flush_wait(struct f2fs_sb_info *sbi,
struct block_device *bdev)
{
int ret = blkdev_issue_flush(bdev);
+ if (!ret)
+ f2fs_update_iostat(sbi, NULL, FS_FLUSH, 0);
trace_f2fs_issue_flush(bdev, test_opt(sbi, NOBARRIER),
test_opt(sbi, FLUSH_MERGE), ret);
--
2.25.1
Powered by blists - more mailing lists