@@ -3597,11 +3597,11 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,
split_map.m_len = map->m_len;
if (max_zeroout && (allocated > map->m_len)) {
- if (allocated <= max_zeroout) {
+ if (allocated - map->m_len <= max_zeroout) {
/* case 3 */
zero_ex.ee_block =
- cpu_to_le32(map->m_lblk);
- zero_ex.ee_len = cpu_to_le16(allocated);
+ cpu_to_le32(map->m_lblk + map->m_len);
+ zero_ex.ee_len = cpu_to_le16(allocated - map->m_len);
ext4_ext_store_pblock(&zero_ex,
ext4_ext_pblock(ex) + map->m_lblk - ee_block);
err = ext4_ext_zeroout(inode, &zero_ex);
When splitting unwritten extent into two extents, currently ext4 zeroout the whole second extent, which contains the requested space. The requested space will soon be written with data. The zeroout of requested space is unncessary, causing more traffic to disk. Signed-off-by: Jun He <jhe@cs.wisc.edu> --- fs/ext4/extents.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html