f2fs: optimize f2fs DIO overwrites
PATCH 1/1 f2fs: optimize f2fs DIO overwrites
this is unnecessary when we know we are overwriting already allocated blocks and the overhead of starting a transaction can be significant especially for multithreaded workloads doing small writes.
Signed-off-by Yohan Joung <[email protected]>
--- fs/f2fs/data.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/f2fs/data.c +2 -1
@@ -4181,7 +4181,8 @@ static int f2fs_iomap_begin(struct inode *inode, loff_t offset, loff_t length, map.m_next_pgofs = &next_pgofs; map.m_seg_type =f2fs_rw_hint_to_seg_type (F2FS_I_SB (inode), inode->i_write_hint); -if (flags &IOMAP_WRITE ) +if ((flags &IOMAP_WRITE ) && + !f2fs_overwrite_io (inode, offset, length)) map.m_may_create = true; err =f2fs_map_blocks (inode, &map,F2FS_GET_BLOCK_DIO );
Signature · 1 line
2.25.1
Chao Yu
maintainerQuoted 14 lines · Yohan Joung
this is unnecessary when we know we are overwriting already allocated blocks and the overhead of starting a transaction can be significant especially for multithreaded workloads doing small writes.
Signed-off-by Yohan Joung <[email protected]>--- fs/f2fs/data.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)fs/f2fs/data.c +0
-0
fs/f2fs/data.c static int f2fs_iomap_begin(struct inode *inode, loff_t offset, loff_t length, · line 4185
Quoted 6 lines
fs/f2fs/data.c +2
-1@@ -4181,7 +4181,8 @@ static int f2fs_iomap_begin(struct inode *inode, loff_t offset, loff_t length, map.m_next_pgofs = &next_pgofs; map.m_seg_type =f2fs_rw_hint_to_seg_type (F2FS_I_SB (inode), inode->i_write_hint); -if (flags &IOMAP_WRITE ) +if ((flags &IOMAP_WRITE ) && + !f2fs_overwrite_io (inode, offset, length))
Can you please add a comment for this change? Otherwise it looks fine to me.
Thanks,
Quoted 3 lines
fs/f2fs/data.c +0
-0map.m_may_create = true; err =f2fs_map_blocks (inode, &map,F2FS_GET_BLOCK_DIO );