f2fs: fix to map blocks correctly for direct read
Chao Yu
maintainerPATCH 1/1 f2fs: fix to map blocks correctly for direct read
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.
--- fs/f2fs/data.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
fs/f2fs/data.c +6 -1
@@ -1676,7 +1676,12 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, int flag)/* reserved delalloc block should be mapped for fiemap. */ if (blkaddr ==NEW_ADDR ) map->m_flags |=F2FS_MAP_DELALLOC ; -if (flag !=F2FS_GET_BLOCK_DIO || !is_hole) +/* +* f2fs_map_blocks() supports to map continuous holes or +* preallocated address, don't set F2FS_MAP_MAPPED for these +* cases only. +*/ +if (flag !=F2FS_GET_BLOCK_DIO || map->m_may_create || !is_hole) map->m_flags |=F2FS_MAP_MAPPED ; map->m_pblk = blkaddr;
Signature · 1 line
2.40.1
Jaegeuk Kim
maintainerQuoted 5 lines · Chao Yu
f2fs_map_blocks()supports to map continuous holes or preallocated address, we should avoid settingF2FS_MAP_MAPPEDfor these cases only, otherwise, it may failf2fs_iomap_begin(), and make direct write fallbacking to use buffered IO and flush, result in performance regression.
Is this fixing direct write or read?
Quoted 15 lines
Fixes 9f0f6bf42714 ("f2fs: support to map continuous holes or preallocated address")Reported-by kernel test robot <[email protected]>Cc Cyril Hrubis <[email protected]>Signed-off-by Chao Yu <[email protected]>--- fs/f2fs/data.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)fs/f2fs/data.c +0
-0
fs/f2fs/data.c int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, int flag) · line 1684
Quoted 10 lines
fs/f2fs/data.c +6
-1@@ -1676,7 +1676,12 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, int flag)/* reserved delalloc block should be mapped for fiemap. */ if (blkaddr ==NEW_ADDR ) map->m_flags |=F2FS_MAP_DELALLOC ; -if (flag !=F2FS_GET_BLOCK_DIO || !is_hole) +/* +* f2fs_map_blocks() supports to map continuous holes or +* preallocated address, don't set F2FS_MAP_MAPPED for these +* cases only. +*/ +if (flag !=F2FS_GET_BLOCK_DIO || map->m_may_create || !is_hole)
So, this is adding map->m_may_create, which is for writes?
Quoted 5 lines
fs/f2fs/data.c +0
-0map->m_flags |=F2FS_MAP_MAPPED ; map->m_pblk = blkaddr;Signature · 1 line
2.40.1
Chao Yu
maintainerQuoted 8 lines · Jaegeuk Kim
Quoted 5 lines · Chao Yu
f2fs_map_blocks()supports to map continuous holes or preallocated address, we should avoid settingF2FS_MAP_MAPPEDfor these cases only, otherwise, it may failf2fs_iomap_begin(), and make direct write fallbacking to use buffered IO and flush, result in performance regression.Is this fixing direct write or read?
Direct write.
Quoted 20 lines
Quoted 20 lines
Fixes 9f0f6bf42714 ("f2fs: support to map continuous holes or preallocated address")Reported-by kernel test robot <[email protected]>Cc Cyril Hrubis <[email protected]>Signed-off-by Chao Yu <[email protected]>--- fs/f2fs/data.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)fs/f2fs/data.c +0
-1@@ -1676,7 +1676,12 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, int flag)/* reserved delalloc block should be mapped for fiemap. */ if (blkaddr ==NEW_ADDR ) map->m_flags |=F2FS_MAP_DELALLOC ; -if (flag !=F2FS_GET_BLOCK_DIO || !is_hole)
Quoted 8 lines
fs/f2fs/data.c int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, int flag) · line 1684
Quoted 6 lines
fs/f2fs/data.c +6
-0+/* +* f2fs_map_blocks() supports to map continuous holes or +* preallocated address, don't set F2FS_MAP_MAPPED for these +* cases only. +*/ +if (flag !=F2FS_GET_BLOCK_DIO || map->m_may_create || !is_hole)So, this is adding
map->m_may_create, which is for writes?
map->m_may_create is added for write path, w/o this condition, f2fs_map_blocks() may missed to tag F2FS_MAP_MAPPED, result in that f2fs_iomap_begin() will return -ENOTBLK.
Am I missing someting?
Thanks,
Quoted 6 lines
Quoted 6 lines
fs/f2fs/data.c +0
-0map->m_flags |=F2FS_MAP_MAPPED ; map->m_pblk = blkaddr;Signature · 1 line
2.40.1
Jaegeuk Kim
maintainerQuoted 11 lines · Chao Yu
Quoted 8 lines · Jaegeuk Kim
Quoted 5 lines · Chao Yu
f2fs_map_blocks()supports to map continuous holes or preallocated address, we should avoid settingF2FS_MAP_MAPPEDfor these cases only, otherwise, it may failf2fs_iomap_begin(), and make direct write fallbacking to use buffered IO and flush, result in performance regression.Is this fixing direct write or read?
Direct write.
I was confising the patch subject is saying direct read.
Quoted 30 lines
Quoted 21 lines
Quoted 21 lines
Fixes 9f0f6bf42714 ("f2fs: support to map continuous holes or preallocated address")Reported-by kernel test robot <[email protected]>Cc Cyril Hrubis <[email protected]>Signed-off-by Chao Yu <[email protected]>--- fs/f2fs/data.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)fs/f2fs/data.c +0
-1@@ -1676,7 +1676,12 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, int flag)/* reserved delalloc block should be mapped for fiemap. */ if (blkaddr ==NEW_ADDR ) map->m_flags |=F2FS_MAP_DELALLOC ; -if (flag !=F2FS_GET_BLOCK_DIO || !is_hole)Quoted 8 lines
fs/f2fs/data.c int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, int flag) · line 1684
Quoted 6 lines
fs/f2fs/data.c +6
-0+/* +* f2fs_map_blocks() supports to map continuous holes or +* preallocated address, don't set F2FS_MAP_MAPPED for these +* cases only. +*/ +if (flag !=F2FS_GET_BLOCK_DIO || map->m_may_create || !is_hole)So, this is adding
map->m_may_create, which is for writes?
Quoted 3 lines
map->m_may_createis added for write path, w/o this condition,f2fs_map_blocks()may missed to tagF2FS_MAP_MAPPED, result in thatf2fs_iomap_begin()will return-ENOTBLK.
Is that something like this?
/* DIO READ and hole case, should not map the blocks. */ if (!(flag == F2FS_GET_BLOCK_DIO && is_hole && !map->m_may_create))
Quoted 10 lines
Am I missing someting?
Thanks,
Quoted 5 lines
Quoted 5 lines
fs/f2fs/data.c +0
-0map->m_flags |=F2FS_MAP_MAPPED ; map->m_pblk = blkaddr;Signature · 1 line
2.40.1
Chao Yu
maintainerQuoted 9 lines · Jaegeuk Kim
Quoted 8 lines · Chao Yu
Quoted 7 lines · Jaegeuk Kim
Quoted 5 lines · Chao Yu
f2fs_map_blocks()supports to map continuous holes or preallocated address, we should avoid settingF2FS_MAP_MAPPEDfor these cases only, otherwise, it may failf2fs_iomap_begin(), and make direct write fallbacking to use buffered IO and flush, result in performance regression.
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Is this fixing direct write or read?
Direct write.
I was confising the patch subject is saying direct read.
Oops, sorry.
Quoted 31 lines
Quoted 31 lines
Quoted 30 lines
Quoted 18 lines
Fixes 9f0f6bf42714 ("f2fs: support to map continuous holes or preallocated address")Reported-by kernel test robot <[email protected]>Cc Cyril Hrubis <[email protected]>Signed-off-by Chao Yu <[email protected]>--- fs/f2fs/data.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)fs/f2fs/data.c +0
-0fs/f2fs/data.c int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, int flag) · line 1684
Quoted 10 lines
fs/f2fs/data.c +6
-1@@ -1676,7 +1676,12 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, int flag)/* reserved delalloc block should be mapped for fiemap. */ if (blkaddr ==NEW_ADDR ) map->m_flags |=F2FS_MAP_DELALLOC ; -if (flag !=F2FS_GET_BLOCK_DIO || !is_hole) +/* +* f2fs_map_blocks() supports to map continuous holes or +* preallocated address, don't set F2FS_MAP_MAPPED for these +* cases only. +*/ +if (flag !=F2FS_GET_BLOCK_DIO || map->m_may_create || !is_hole)So, this is adding
map->m_may_create, which is for writes?
Quoted 8 lines
Quoted 3 lines
map->m_may_createis added for write path, w/o this condition,f2fs_map_blocks()may missed to tagF2FS_MAP_MAPPED, result in thatf2fs_iomap_begin()will return-ENOTBLK.Is that something like this?
/* DIO READ and hole case, should not map the blocks. */ if (!(flag ==
F2FS_GET_BLOCK_DIO&&is_hole&& !map->m_may_create))
More clear, will update w/ this.
Thanks,
Quoted 11 lines
Quoted 11 lines
Am I missing someting?
Thanks,
Quoted 5 lines
Quoted 5 lines
fs/f2fs/data.c +0
-0map->m_flags |=F2FS_MAP_MAPPED ; map->m_pblk = blkaddr;Signature · 1 line
2.40.1