From: Chao Yu Date: Tue, 12 Dec 2023 01:01:20 +0000 (+0800) Subject: f2fs: don't set FI_PREALLOCATED_ALL for partial write X-Git-Tag: v6.8-rc1~112^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=394e7f4dbb32a44ad1a1569d55aa680e28ab3315;p=thirdparty%2Flinux.git 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 Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim --- diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 79d5b64c109c8..026d05a7edd84 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -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);