2023-07-05 19:17:42

by Jeff Layton

[permalink] [raw]
Subject: [PATCH v2 13/92] ntfs3: convert to simple_rename_timestamp

A rename potentially involves updating 4 different inode timestamps.
Convert to the new simple_rename_timestamp helper function.

Signed-off-by: Jeff Layton <[email protected]>
---
fs/ntfs3/namei.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/fs/ntfs3/namei.c b/fs/ntfs3/namei.c
index 70f8c859e0ad..bfd986699f9e 100644
--- a/fs/ntfs3/namei.c
+++ b/fs/ntfs3/namei.c
@@ -324,14 +324,11 @@ static int ntfs_rename(struct mnt_idmap *idmap, struct inode *dir,
/* Restore after failed rename failed too. */
_ntfs_bad_inode(inode);
} else if (!err) {
- inode->i_ctime = dir->i_ctime = dir->i_mtime =
- current_time(dir);
+ simple_rename_timestamp(dir, dentry, new_dir, new_dentry);
mark_inode_dirty(inode);
mark_inode_dirty(dir);
- if (dir != new_dir) {
- new_dir->i_mtime = new_dir->i_ctime = dir->i_ctime;
+ if (dir != new_dir)
mark_inode_dirty(new_dir);
- }

if (IS_DIRSYNC(dir))
ntfs_sync_inode(dir);
--
2.41.0



2023-07-06 10:49:52

by Jan Kara

[permalink] [raw]
Subject: Re: [PATCH v2 13/92] ntfs3: convert to simple_rename_timestamp

On Wed 05-07-23 15:00:38, Jeff Layton wrote:
> A rename potentially involves updating 4 different inode timestamps.
> Convert to the new simple_rename_timestamp helper function.
>
> Signed-off-by: Jeff Layton <[email protected]>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <[email protected]>

Honza

> ---
> fs/ntfs3/namei.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/fs/ntfs3/namei.c b/fs/ntfs3/namei.c
> index 70f8c859e0ad..bfd986699f9e 100644
> --- a/fs/ntfs3/namei.c
> +++ b/fs/ntfs3/namei.c
> @@ -324,14 +324,11 @@ static int ntfs_rename(struct mnt_idmap *idmap, struct inode *dir,
> /* Restore after failed rename failed too. */
> _ntfs_bad_inode(inode);
> } else if (!err) {
> - inode->i_ctime = dir->i_ctime = dir->i_mtime =
> - current_time(dir);
> + simple_rename_timestamp(dir, dentry, new_dir, new_dentry);
> mark_inode_dirty(inode);
> mark_inode_dirty(dir);
> - if (dir != new_dir) {
> - new_dir->i_mtime = new_dir->i_ctime = dir->i_ctime;
> + if (dir != new_dir)
> mark_inode_dirty(new_dir);
> - }
>
> if (IS_DIRSYNC(dir))
> ntfs_sync_inode(dir);
> --
> 2.41.0
>
--
Jan Kara <[email protected]>
SUSE Labs, CR