Skip to content

Commit 1c972b1

Browse files
riteshharjanitytso
authored andcommitted
ext4: Check if inode uses extents in ext4_inode_can_atomic_write()
EXT4 only supports doing atomic write on inodes which uses extents, so add a check in ext4_inode_can_atomic_write() which gets called during open. Reviewed-by: Ojaswin Mujoo <[email protected]> Acked-by: Darrick J. Wong <[email protected]> Signed-off-by: Ritesh Harjani (IBM) <[email protected]> Link: https://patch.msgid.link/86bb502c979398a736ab371d8f35f6866a477f6c.1747337952.git.ritesh.list@gmail.com Signed-off-by: Theodore Ts'o <[email protected]>
1 parent 9fa6121 commit 1c972b1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

fs/ext4/ext4.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3870,7 +3870,9 @@ static inline int ext4_buffer_uptodate(struct buffer_head *bh)
38703870
static inline bool ext4_inode_can_atomic_write(struct inode *inode)
38713871
{
38723872

3873-
return S_ISREG(inode->i_mode) && EXT4_SB(inode->i_sb)->s_awu_min > 0;
3873+
return S_ISREG(inode->i_mode) &&
3874+
ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS) &&
3875+
EXT4_SB(inode->i_sb)->s_awu_min > 0;
38743876
}
38753877

38763878
extern int ext4_block_write_begin(handle_t *handle, struct folio *folio,

0 commit comments

Comments
 (0)