Skip to content

Commit 5dd00eb

Browse files
chaseyuJaegeuk Kim
authored andcommitted
f2fs: fix to map blocks correctly for direct write
f2fs_map_blocks() supports to map continuous holes or preallocated address, we should avoid setting F2FS_MAP_MAPPED for these cases only, otherwise, it may fail f2fs_iomap_begin(), and make direct write fallbacking to use buffered IO and flush, result in performance regression. Fixes: 9f0f6bf ("f2fs: support to map continuous holes or preallocated address") Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-lkp/[email protected] Cc: Cyril Hrubis <[email protected]> Signed-off-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent 7b0033d commit 5dd00eb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/f2fs/data.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1676,7 +1676,8 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, int flag)
16761676
/* reserved delalloc block should be mapped for fiemap. */
16771677
if (blkaddr == NEW_ADDR)
16781678
map->m_flags |= F2FS_MAP_DELALLOC;
1679-
if (flag != F2FS_GET_BLOCK_DIO || !is_hole)
1679+
/* DIO READ and hole case, should not map the blocks. */
1680+
if (!(flag == F2FS_GET_BLOCK_DIO && is_hole && !map->m_may_create))
16801681
map->m_flags |= F2FS_MAP_MAPPED;
16811682

16821683
map->m_pblk = blkaddr;

0 commit comments

Comments
 (0)