* [PATCH v2] f2fs: skip direct I/O iostat context when disabled
@ 2026-06-16 3:06 Wenjie Qi
2026-06-16 3:16 ` Chao Yu
2026-06-17 14:30 ` [f2fs-dev] " patchwork-bot+f2fs
0 siblings, 2 replies; 3+ messages in thread
From: Wenjie Qi @ 2026-06-16 3:06 UTC (permalink / raw)
To: jaegeuk, chao; +Cc: linux-f2fs-devel, linux-kernel, qiwenjie, qwjhust
F2FS iostat is optional and is disabled by default. Direct I/O still
allocates and binds a bio_iostat_ctx, updates the submit timestamp, and
replaces bi_end_io for every DIO bio even when sbi->iostat_enable is
false.
The byte accounting calls do not need an extra guard because
f2fs_update_iostat() already checks sbi->iostat_enable. Only skip the
DIO bio context setup when iostat is disabled. If iostat is enabled
through sysfs before submission, the existing context allocation and
latency accounting path is still used.
QEMU benchmark on a 1GiB F2FS virtio-blk image, with iostat_enable=0,
4KiB O_DIRECT I/O over a 64MiB file, 50000 iterations per run:
baseline patched
direct_read median 65264.50 ns 55470.95 ns
direct_read recheck 65553.75 ns 55470.95 ns
direct_write median 68054.62 ns 56309.44 ns
direct_write recheck 66873.51 ns 56309.44 ns
Signed-off-by: Wenjie Qi <qiwenjie@xiaomi.com>
---
Changes in v2:
- Drop the extra guards around f2fs_update_iostat(), since it already checks
sbi->iostat_enable.
- Limit the change to skipping DIO bio iostat context setup.
fs/f2fs/file.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 6edf0105dbc8..d8d895c27026 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -4799,6 +4799,9 @@ static void f2fs_dio_iostat_start(struct f2fs_sb_info *sbi, struct bio *bio)
{
void *bi_private = bio->bi_private;
+ if (!sbi->iostat_enable)
+ return;
+
iostat_alloc_and_bind_ctx(sbi, bio, bi_private);
iostat_update_submit_ctx(bio, DATA);
bio->bi_end_io = f2fs_dio_end_bio;
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] f2fs: skip direct I/O iostat context when disabled
2026-06-16 3:06 [PATCH v2] f2fs: skip direct I/O iostat context when disabled Wenjie Qi
@ 2026-06-16 3:16 ` Chao Yu
2026-06-17 14:30 ` [f2fs-dev] " patchwork-bot+f2fs
1 sibling, 0 replies; 3+ messages in thread
From: Chao Yu @ 2026-06-16 3:16 UTC (permalink / raw)
To: Wenjie Qi, jaegeuk; +Cc: chao, linux-f2fs-devel, linux-kernel, qiwenjie
On 6/16/26 11:06, Wenjie Qi wrote:
> F2FS iostat is optional and is disabled by default. Direct I/O still
> allocates and binds a bio_iostat_ctx, updates the submit timestamp, and
> replaces bi_end_io for every DIO bio even when sbi->iostat_enable is
> false.
>
> The byte accounting calls do not need an extra guard because
> f2fs_update_iostat() already checks sbi->iostat_enable. Only skip the
> DIO bio context setup when iostat is disabled. If iostat is enabled
> through sysfs before submission, the existing context allocation and
> latency accounting path is still used.
>
> QEMU benchmark on a 1GiB F2FS virtio-blk image, with iostat_enable=0,
> 4KiB O_DIRECT I/O over a 64MiB file, 50000 iterations per run:
>
> baseline patched
> direct_read median 65264.50 ns 55470.95 ns
> direct_read recheck 65553.75 ns 55470.95 ns
> direct_write median 68054.62 ns 56309.44 ns
> direct_write recheck 66873.51 ns 56309.44 ns
>
> Signed-off-by: Wenjie Qi <qiwenjie@xiaomi.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Thanks,
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [f2fs-dev] [PATCH v2] f2fs: skip direct I/O iostat context when disabled
2026-06-16 3:06 [PATCH v2] f2fs: skip direct I/O iostat context when disabled Wenjie Qi
2026-06-16 3:16 ` Chao Yu
@ 2026-06-17 14:30 ` patchwork-bot+f2fs
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+f2fs @ 2026-06-17 14:30 UTC (permalink / raw)
To: Wenjie Qi; +Cc: jaegeuk, chao, qiwenjie, linux-kernel, linux-f2fs-devel
Hello:
This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <jaegeuk@kernel.org>:
On Tue, 16 Jun 2026 11:06:55 +0800 you wrote:
> F2FS iostat is optional and is disabled by default. Direct I/O still
> allocates and binds a bio_iostat_ctx, updates the submit timestamp, and
> replaces bi_end_io for every DIO bio even when sbi->iostat_enable is
> false.
>
> The byte accounting calls do not need an extra guard because
> f2fs_update_iostat() already checks sbi->iostat_enable. Only skip the
> DIO bio context setup when iostat is disabled. If iostat is enabled
> through sysfs before submission, the existing context allocation and
> latency accounting path is still used.
>
> [...]
Here is the summary with links:
- [f2fs-dev,v2] f2fs: skip direct I/O iostat context when disabled
https://git.kernel.org/jaegeuk/f2fs/c/b51f606aa323
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-06-17 14:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-16 3:06 [PATCH v2] f2fs: skip direct I/O iostat context when disabled Wenjie Qi
2026-06-16 3:16 ` Chao Yu
2026-06-17 14:30 ` [f2fs-dev] " patchwork-bot+f2fs
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome