lkml.org 
[lkml]   [2022]   [Dec]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/2] f2fs: add iostat support for flush
Date
In this patch, it adds to account flush count.

Signed-off-by: Yangtao Li <frank.li@vivo.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
\
 
 \ /
  Last update: 2023-03-26 23:17    [W:0.060 / U:1.316 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site