Skip to contentSkip to conversation

f2fs: zone: fix to don't trigger OPU on pinfile for direct IO

PATCH Applied Chao Yu 3 participants 3 messages Apr 28, 2024 – May 11, 2024 F2FS file system

lore
Share & tools
lore

Chao Yu

author maintainer
#0 lore raw

PATCH v2 1/1 f2fs: zone: fix to don't trigger OPU on pinfile for direct IO

Otherwise, it breaks pinfile's sematics.

Cc Daeho Jeong <[email protected]>

---
v2:
- fix to disallow OPU on pinfile no matter what device type f2fs uses.

 fs/f2fs/data.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
fs/f2fs/data.c +3 -2
index d8e4434e8801..56600dd43834 100644
@@ -1595,8 +1595,9 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, int flag)
 	}
 
 	/* use out-place-update for direct IO under LFS mode */
-	if (map->m_may_create &&
-	    (is_hole || (f2fs_lfs_mode(sbi) && flag == F2FS_GET_BLOCK_DIO))) {
+	if (map->m_may_create && (is_hole ||
+		(flag == F2FS_GET_BLOCK_DIO && f2fs_lfs_mode(sbi) &&
+		!f2fs_is_pinned_file(inode)))) {
 		if (unlikely(f2fs_cp_error(sbi))) {
 			err = -EIO;
 			goto sync_out;
Signature · 1 line
2.40.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 28 lines · Chao Yu

Otherwise, it breaks pinfile's sematics.

Cc Daeho Jeong <[email protected]>

---
v2:
- fix to disallow OPU on pinfile no matter what device type f2fs uses.

 fs/f2fs/data.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
fs/f2fs/data.c +3 -3
index d8e4434e8801..56600dd43834 100644
@@ -1595,8 +1595,9 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, int flag)
        }
 
        /* use out-place-update for direct IO under LFS mode */
-       if (map->m_may_create &&
-           (is_hole || (f2fs_lfs_mode(sbi) && flag == F2FS_GET_BLOCK_DIO))) {
+       if (map->m_may_create && (is_hole ||
+               (flag == F2FS_GET_BLOCK_DIO && f2fs_lfs_mode(sbi) &&
+               !f2fs_is_pinned_file(inode)))) {
                if (unlikely(f2fs_cp_error(sbi))) {
                        err = -EIO;
                        goto sync_out;
--
Quoted 2 lines

2.40.1

Thanks,

#2 lore raw
In reply to Chao Yu
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 9 lines · On Sun, 28 Apr 2024 09:12:36 +0800 you wrote:

Otherwise, it breaks pinfile's sematics.

Cc Daeho Jeong <[email protected]>

---
v2:
- fix to disallow OPU on pinfile no matter what device type f2fs uses.

 fs/f2fs/data.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Here is the summary with links:
- [f2fs-dev,v2] f2fs: zone: fix to don't trigger OPU on pinfile for direct IO

    https://git.kernel.org/jaegeuk/f2fs/c/48d180e2bf5a

You are awesome, thank you!

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