* [f2fs-dev] [PATCH] f2fs: add iostat support for FS_DISCARD_IO
@ 2022-12-12 5:47 Yangtao Li via Linux-f2fs-devel
2022-12-12 10:23 ` Chao Yu
0 siblings, 1 reply; 3+ messages in thread
From: Yangtao Li via Linux-f2fs-devel @ 2022-12-12 5:47 UTC (permalink / raw)
To: jaegeuk, chao; +Cc: Yangtao Li, linux-kernel, linux-f2fs-devel
Just like other data we count uses the number of bytes as the basic
unit, but discard uses the number of cmds as the statistical unit. In
fact, the discard command contains the number of blocks. In order to
avoid breaking its usage of application, let's keeping FS_DISCARD
as it is, and add FS_DISCARD_IO to account discard bytes.
Suggested-by: Chao Yu <chao@kernel.org>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
fs/f2fs/f2fs.h | 1 +
fs/f2fs/iostat.c | 5 +++++
fs/f2fs/segment.c | 2 +-
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index e8953c3dc81a..ef0043003bf8 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -1193,6 +1193,7 @@ enum iostat_type {
FS_META_READ_IO, /* meta read IOs */
/* other */
+ FS_DISCARD_IO, /* discard IOs */
FS_DISCARD, /* discard */
NR_IO_TYPE,
};
diff --git a/fs/f2fs/iostat.c b/fs/f2fs/iostat.c
index 3166a8939ed4..3d2f0b69cdda 100644
--- a/fs/f2fs/iostat.c
+++ b/fs/f2fs/iostat.c
@@ -89,6 +89,8 @@ int __maybe_unused iostat_info_seq_show(struct seq_file *seq, void *offset)
/* print other IOs */
seq_puts(seq, "[OTHER]\n");
+ seq_printf(seq, "fs discard bytes: %-16llu\n",
+ sbi->rw_iostat[FS_DISCARD_IO]);
seq_printf(seq, "fs discard: %-16llu\n",
sbi->rw_iostat[FS_DISCARD]);
@@ -180,6 +182,9 @@ void f2fs_update_iostat(struct f2fs_sb_info *sbi, struct inode *inode,
spin_lock_irqsave(&sbi->iostat_lock, flags);
sbi->rw_iostat[type] += io_bytes;
+ if (type == FS_DISCARD_IO)
+ sbi->rw_iostat[FS_DISCARD]++;
+
if (type == APP_BUFFERED_IO || type == APP_DIRECT_IO)
sbi->rw_iostat[APP_WRITE_IO] += io_bytes;
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index dee712f7225f..bd02631f9681 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -1187,7 +1187,7 @@ static int __submit_discard_cmd(struct f2fs_sb_info *sbi,
atomic_inc(&dcc->issued_discard);
- f2fs_update_iostat(sbi, NULL, FS_DISCARD, 1);
+ f2fs_update_iostat(sbi, NULL, FS_DISCARD_IO, len * F2FS_BLKSIZE);
lstart += len;
start += len;
--
2.25.1
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs: add iostat support for FS_DISCARD_IO
2022-12-12 5:47 [f2fs-dev] [PATCH] f2fs: add iostat support for FS_DISCARD_IO Yangtao Li via Linux-f2fs-devel
@ 2022-12-12 10:23 ` Chao Yu
2022-12-12 23:01 ` Jaegeuk Kim
0 siblings, 1 reply; 3+ messages in thread
From: Chao Yu @ 2022-12-12 10:23 UTC (permalink / raw)
To: Yangtao Li, jaegeuk; +Cc: linux-kernel, linux-f2fs-devel
On 2022/12/12 13:47, Yangtao Li wrote:
> Just like other data we count uses the number of bytes as the basic
> unit, but discard uses the number of cmds as the statistical unit. In
> fact, the discard command contains the number of blocks. In order to
> avoid breaking its usage of application, let's keeping FS_DISCARD
> as it is, and add FS_DISCARD_IO to account discard bytes.
>
> Suggested-by: Chao Yu <chao@kernel.org>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Thanks,
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs: add iostat support for FS_DISCARD_IO
2022-12-12 10:23 ` Chao Yu
@ 2022-12-12 23:01 ` Jaegeuk Kim
0 siblings, 0 replies; 3+ messages in thread
From: Jaegeuk Kim @ 2022-12-12 23:01 UTC (permalink / raw)
To: Chao Yu; +Cc: linux-f2fs-devel, linux-kernel, Yangtao Li
Please check the previous comment.
On 12/12, Chao Yu wrote:
> On 2022/12/12 13:47, Yangtao Li wrote:
> > Just like other data we count uses the number of bytes as the basic
> > unit, but discard uses the number of cmds as the statistical unit. In
> > fact, the discard command contains the number of blocks. In order to
> > avoid breaking its usage of application, let's keeping FS_DISCARD
> > as it is, and add FS_DISCARD_IO to account discard bytes.
> >
> > Suggested-by: Chao Yu <chao@kernel.org>
> > Signed-off-by: Yangtao Li <frank.li@vivo.com>
>
> Reviewed-by: Chao Yu <chao@kernel.org>
>
> Thanks,
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-12-12 23:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-12 5:47 [f2fs-dev] [PATCH] f2fs: add iostat support for FS_DISCARD_IO Yangtao Li via Linux-f2fs-devel
2022-12-12 10:23 ` Chao Yu
2022-12-12 23:01 ` Jaegeuk Kim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).