summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYang Erkun <yangerkun@huawei.com>2025-11-12 16:45:38 +0800
committerTheodore Ts'o <tytso@mit.edu>2025-11-26 17:13:34 -0500
commitcc742fd1d184bb2a11bacf50587d2c85290622e4 (patch)
tree66cd7e3d8107d56bf2bf3a584f43838735dddf07
parenta9272422316f6c0ddbdfd03e695079e2b3655995 (diff)
ext4: correct the comments place for EXT4_EXT_MAY_ZEROOUT
Move the comments just before we set EXT4_EXT_MAY_ZEROOUT in ext4_split_convert_extents. Signed-off-by: Yang Erkun <yangerkun@huawei.com> Message-ID: <20251112084538.1658232-4-yangerkun@huawei.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r--fs/ext4/extents.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index b9be5d8320de..885e933b6803 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -3721,10 +3721,6 @@ static struct ext4_ext_path *ext4_split_convert_extents(handle_t *handle,
>> inode->i_sb->s_blocksize_bits;
if (eof_block < map->m_lblk + map->m_len)
eof_block = map->m_lblk + map->m_len;
- /*
- * It is safe to convert extent to initialized via explicit
- * zeroout only if extent is fully inside i_size or new_size.
- */
depth = ext_depth(inode);
ex = path[depth].p_ext;
ee_block = le32_to_cpu(ex->ee_block);
@@ -3735,6 +3731,10 @@ static struct ext4_ext_path *ext4_split_convert_extents(handle_t *handle,
split_flag |= EXT4_EXT_DATA_VALID1;
/* Convert to initialized */
} else if (flags & EXT4_GET_BLOCKS_CONVERT) {
+ /*
+ * It is safe to convert extent to initialized via explicit
+ * zeroout only if extent is fully inside i_size or new_size.
+ */
split_flag |= ee_block + ee_len <= eof_block ?
EXT4_EXT_MAY_ZEROOUT : 0;
split_flag |= (EXT4_EXT_MARK_UNWRIT2 | EXT4_EXT_DATA_VALID2);