Skip to content

Commit d9116d2

Browse files
zhangyi089gregkh
authored andcommitted
ext4: don't explicit update times in ext4_fallocate()
[ Upstream commit 73ae756 ] After commit 'ad5cd4f4ee4d ("ext4: fix fallocate to use file_modified to update permissions consistently"), we can update mtime and ctime appropriately through file_modified() when doing zero range, collapse rage, insert range and punch hole, hence there is no need to explicit update times in those paths, just drop them. Signed-off-by: Zhang Yi <[email protected]> Reviewed-by: Jan Kara <[email protected]> Reviewed-by: Ojaswin Mujoo <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Theodore Ts'o <[email protected]> Stable-dep-of: 29ec9be ("ext4: fix incorrect punch max_end") Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent a5ae7fa commit d9116d2

File tree

2 files changed

+0
-6
lines changed

2 files changed

+0
-6
lines changed

fs/ext4/extents.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4675,8 +4675,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
46754675
goto out_mutex;
46764676
}
46774677

4678-
inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode));
4679-
46804678
ret = ext4_alloc_file_blocks(file, lblk, max_blocks, new_size,
46814679
flags);
46824680
filemap_invalidate_unlock(mapping);
@@ -4700,7 +4698,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
47004698
goto out_mutex;
47014699
}
47024700

4703-
inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode));
47044701
if (new_size)
47054702
ext4_update_inode_size(inode, new_size);
47064703
ret = ext4_mark_inode_dirty(handle, inode);
@@ -5431,7 +5428,6 @@ static int ext4_collapse_range(struct file *file, loff_t offset, loff_t len)
54315428
up_write(&EXT4_I(inode)->i_data_sem);
54325429
if (IS_SYNC(inode))
54335430
ext4_handle_sync(handle);
5434-
inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode));
54355431
ret = ext4_mark_inode_dirty(handle, inode);
54365432
ext4_update_inode_fsync_trans(handle, inode, 1);
54375433

@@ -5541,7 +5537,6 @@ static int ext4_insert_range(struct file *file, loff_t offset, loff_t len)
55415537
/* Expand file to avoid data loss if there is error while shifting */
55425538
inode->i_size += len;
55435539
EXT4_I(inode)->i_disksize += len;
5544-
inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode));
55455540
ret = ext4_mark_inode_dirty(handle, inode);
55465541
if (ret)
55475542
goto out_stop;

fs/ext4/inode.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4113,7 +4113,6 @@ int ext4_punch_hole(struct file *file, loff_t offset, loff_t length)
41134113
if (IS_SYNC(inode))
41144114
ext4_handle_sync(handle);
41154115

4116-
inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode));
41174116
ret2 = ext4_mark_inode_dirty(handle, inode);
41184117
if (unlikely(ret2))
41194118
ret = ret2;

0 commit comments

Comments
 (0)