Skip to contentSkip to conversation

f2fs: zone: wait for inflight dio completion, excluding pinned files read using dio

PATCH Applied yohan.joung 3 participants 3 messages Jul 22, 2025 – Jul 24, 2025 F2FS file system

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 f2fs: zone: wait for inflight dio completion, excluding pinned files read using dio

read for the pinfile using Direct I/O do not wait for dio write.

---
 fs/f2fs/file.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
fs/f2fs/file.c +6 -2
index 4039ccb5022c..58a4d25eb08f 100644
@@ -4834,6 +4834,7 @@ static ssize_t f2fs_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
 	struct inode *inode = file_inode(iocb->ki_filp);
 	const loff_t pos = iocb->ki_pos;
 	ssize_t ret;
+	bool dio;
 
 	if (!f2fs_is_compress_backend_ready(inode))
 		return -EOPNOTSUPP;
@@ -4842,12 +4843,15 @@ static ssize_t f2fs_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
 		f2fs_trace_rw_file_path(iocb->ki_filp, iocb->ki_pos,
 					iov_iter_count(to), READ);
 
+	dio = f2fs_should_use_dio(inode, iocb, to);
+
 	/* In LFS mode, if there is inflight dio, wait for its completion */
 	if (f2fs_lfs_mode(F2FS_I_SB(inode)) &&
-	    get_pages(F2FS_I_SB(inode), F2FS_DIO_WRITE))
+	    get_pages(F2FS_I_SB(inode), F2FS_DIO_WRITE) &&
+		(!f2fs_is_pinned_file(inode) || !dio))
 		inode_dio_wait(inode);
 
-	if (f2fs_should_use_dio(inode, iocb, to)) {
+	if (dio) {
 		ret = f2fs_dio_read_iter(iocb, to);
 	} else {
 		ret = filemap_read(iocb, to, 0);
Signature · 1 line
2.33.0
#2 lore raw
In reply to yohan.joung
This patch was applied to jaegeuk/f2fs.git (dev) by Jaegeuk Kim <[email protected]>:

Hello:

This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <[email protected]>:

Quoted 6 lines · On Tue, 22 Jul 2025 15:02:40 +0900 you wrote:

read for the pinfile using Direct I/O do not wait for dio write.

---
 fs/f2fs/file.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Here is the summary with links:
- [f2fs-dev,v3] f2fs: zone: wait for inflight dio completion, excluding pinned files read using dio

    https://git.kernel.org/jaegeuk/f2fs/c/3bf1bab503a5

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html