[RFC PATCH 2/9] ext4: stop creating inline data for new regular files

Yun Zhou <[email protected]> Mon, 27 Jul 2026 18:54:34 +0800
Newsgroups org.kernel.vger.linux-ext4,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
Stop setting EXT4_STATE_MAY_INLINE_DATA for newly allocated regular
file inodes.  New files always use block-based storage.  Directories
retain inline data capability as it still provides value for small
directories without the write path complexity.

Existing file inodes with inline data are not affected -- MAY_INLINE_DATA
is still set for them during iget via ext4_find_inline_data_nolock().

Signed-off-by: Yun Zhou <[email protected]>
---
 fs/ext4/ialloc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index a40cb27f8116..278f0ab8c996 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -1305,8 +1305,8 @@ struct inode *__ext4_new_inode(struct mnt_idmap *idmap,
 
 	ei->i_extra_isize = sbi->s_want_extra_isize;
 	ei->i_inline_off = 0;
-	if (ext4_has_feature_inline_data(sb) &&
-	    (!(ei->i_flags & (EXT4_DAX_FL|EXT4_EA_INODE_FL)) || S_ISDIR(mode)))
+	if (ext4_has_feature_inline_data(sb) && S_ISDIR(mode) &&
+	    !(ei->i_flags & EXT4_DAX_FL))
 		ext4_set_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA);
 	ret = inode;
 	err = dquot_alloc_inode(inode);
-- 
2.43.0