mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1] f2fs: optimize f2fs DIO overwrites
@ 2025-03-12 13:48 Yohan Joung
  2025-03-17  3:20 ` Chao Yu
  0 siblings, 1 reply; 2+ messages in thread
From: Yohan Joung @ 2025-03-12 13:48 UTC (permalink / raw)
  To: jaegeuk, chao, daeho43; +Cc: linux-f2fs-devel, linux-kernel, 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 <yohan.joung@sk.com>
---
 fs/f2fs/data.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index d872f785a996..b55d253f7be9 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -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);
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v1] f2fs: optimize f2fs DIO overwrites
  2025-03-12 13:48 [PATCH v1] f2fs: optimize f2fs DIO overwrites Yohan Joung
@ 2025-03-17  3:20 ` Chao Yu
  0 siblings, 0 replies; 2+ messages in thread
From: Chao Yu @ 2025-03-17  3:20 UTC (permalink / raw)
  To: Yohan Joung, jaegeuk, daeho43
  Cc: chao, linux-f2fs-devel, linux-kernel, Yohan Joung

On 3/12/25 21:48, Yohan Joung wrote:
> 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 <yohan.joung@sk.com>
> ---
>  fs/f2fs/data.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> index d872f785a996..b55d253f7be9 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -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,

>  		map.m_may_create = true;
>  
>  	err = f2fs_map_blocks(inode, &map, F2FS_GET_BLOCK_DIO);


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-03-17  3:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-12 13:48 [PATCH v1] f2fs: optimize f2fs DIO overwrites Yohan Joung
2025-03-17  3:20 ` Chao Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®