Skip to contentSkip to conversation

f2fs: don't set FI_PREALLOCATED_ALL for partial write

PATCH New Chao Yu 2 participants 2 messages Dec 12, 2023 – Dec 14, 2023 F2FS file system

lore
Share & tools
lore

Chao Yu

author maintainer
#0 lore raw

PATCH v2 4/6 f2fs: don't set FI_PREALLOCATED_ALL for partial write

In f2fs_preallocate_blocks(), if it is partial write in 4KB, it's not necessary to call f2fs_map_blocks() and set FI_PREALLOCATED_ALL flag.

Cc Eric Biggers <[email protected]>

---
v2:
- clean up codes

 fs/f2fs/file.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/f2fs/file.c +2 -1
index 79d5b64c109c..026d05a7edd8 100644
@@ -4567,7 +4567,8 @@ static int f2fs_preallocate_blocks(struct kiocb *iocb, struct iov_iter *iter,
 	if (map.m_len > map.m_lblk)
 		map.m_len -= map.m_lblk;
 	else
-		map.m_len = 0;
+		return 0;
+
 	map.m_may_create = true;
 	if (dio) {
 		map.m_seg_type = f2fs_rw_hint_to_seg_type(inode->i_write_hint);
Signature · 1 line
2.40.1
#1 lore raw
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 10 lines · On Tue, 12 Dec 2023 09:01:20 +0800 you wrote:

In f2fs_preallocate_blocks(), if it is partial write in 4KB, it's not necessary to call f2fs_map_blocks() and set FI_PREALLOCATED_ALL flag.

Cc Eric Biggers <[email protected]>

---
v2:
- clean up codes

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

Here is the summary with links:
- [f2fs-dev,v2,4/6] f2fs: don't set FI_PREALLOCATED_ALL for partial write

    https://git.kernel.org/jaegeuk/f2fs/c/394e7f4dbb32

You are awesome, thank you!

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