exfat: convert to ctime accessor functions
authorJeff Layton <jlayton@kernel.org>
Wed, 5 Jul 2023 19:01:05 +0000 (15:01 -0400)
committerChristian Brauner <brauner@kernel.org>
Thu, 13 Jul 2023 08:28:07 +0000 (10:28 +0200)
In later patches, we're going to change how the inode's ctime field is
used. Switch to using accessor functions instead of raw accesses of
inode->i_ctime.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Message-Id: <20230705190309.579783-38-jlayton@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/exfat/file.c
fs/exfat/inode.c
fs/exfat/namei.c
fs/exfat/super.c

index 3cbd270..f40ecfe 100644 (file)
@@ -22,7 +22,7 @@ static int exfat_cont_expand(struct inode *inode, loff_t size)
        if (err)
                return err;
 
-       inode->i_ctime = inode->i_mtime = current_time(inode);
+       inode->i_mtime = inode_set_ctime_current(inode);
        mark_inode_dirty(inode);
 
        if (!IS_SYNC(inode))
@@ -290,7 +290,7 @@ int exfat_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
        }
 
        if (attr->ia_valid & ATTR_SIZE)
-               inode->i_mtime = inode->i_ctime = current_time(inode);
+               inode->i_mtime = inode_set_ctime_current(inode);
 
        setattr_copy(&nop_mnt_idmap, inode, attr);
        exfat_truncate_atime(&inode->i_atime);
index 481dd33..13329ba 100644 (file)
@@ -355,7 +355,7 @@ static void exfat_write_failed(struct address_space *mapping, loff_t to)
 
        if (to > i_size_read(inode)) {
                truncate_pagecache(inode, i_size_read(inode));
-               inode->i_mtime = inode->i_ctime = current_time(inode);
+               inode->i_mtime = inode_set_ctime_current(inode);
                exfat_truncate(inode);
        }
 }
@@ -398,7 +398,7 @@ static int exfat_write_end(struct file *file, struct address_space *mapping,
                exfat_write_failed(mapping, pos+len);
 
        if (!(err < 0) && !(ei->attr & ATTR_ARCHIVE)) {
-               inode->i_mtime = inode->i_ctime = current_time(inode);
+               inode->i_mtime = inode_set_ctime_current(inode);
                ei->attr |= ATTR_ARCHIVE;
                mark_inode_dirty(inode);
        }
@@ -577,7 +577,7 @@ static int exfat_fill_inode(struct inode *inode, struct exfat_dir_entry *info)
 
        inode->i_blocks = round_up(i_size_read(inode), sbi->cluster_size) >> 9;
        inode->i_mtime = info->mtime;
-       inode->i_ctime = info->mtime;
+       inode_set_ctime_to_ts(inode, info->mtime);
        ei->i_crtime = info->crtime;
        inode->i_atime = info->atime;
 
index e91022f..1b9f587 100644 (file)
@@ -569,7 +569,7 @@ static int exfat_create(struct mnt_idmap *idmap, struct inode *dir,
                goto unlock;
 
        inode_inc_iversion(dir);
-       dir->i_ctime = dir->i_mtime = current_time(dir);
+       dir->i_mtime = inode_set_ctime_current(dir);
        if (IS_DIRSYNC(dir))
                exfat_sync_inode(dir);
        else
@@ -582,8 +582,7 @@ static int exfat_create(struct mnt_idmap *idmap, struct inode *dir,
                goto unlock;
 
        inode_inc_iversion(inode);
-       inode->i_mtime = inode->i_atime = inode->i_ctime =
-               EXFAT_I(inode)->i_crtime = current_time(inode);
+       inode->i_mtime = inode->i_atime = EXFAT_I(inode)->i_crtime = inode_set_ctime_current(inode);
        exfat_truncate_atime(&inode->i_atime);
        /* timestamp is already written, so mark_inode_dirty() is unneeded. */
 
@@ -817,7 +816,7 @@ static int exfat_unlink(struct inode *dir, struct dentry *dentry)
        ei->dir.dir = DIR_DELETED;
 
        inode_inc_iversion(dir);
-       dir->i_mtime = dir->i_atime = dir->i_ctime = current_time(dir);
+       dir->i_mtime = dir->i_atime = inode_set_ctime_current(dir);
        exfat_truncate_atime(&dir->i_atime);
        if (IS_DIRSYNC(dir))
                exfat_sync_inode(dir);
@@ -825,7 +824,7 @@ static int exfat_unlink(struct inode *dir, struct dentry *dentry)
                mark_inode_dirty(dir);
 
        clear_nlink(inode);
-       inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
+       inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode);
        exfat_truncate_atime(&inode->i_atime);
        exfat_unhash_inode(inode);
        exfat_d_version_set(dentry, inode_query_iversion(dir));
@@ -852,7 +851,7 @@ static int exfat_mkdir(struct mnt_idmap *idmap, struct inode *dir,
                goto unlock;
 
        inode_inc_iversion(dir);
-       dir->i_ctime = dir->i_mtime = current_time(dir);
+       dir->i_mtime = inode_set_ctime_current(dir);
        if (IS_DIRSYNC(dir))
                exfat_sync_inode(dir);
        else
@@ -866,8 +865,7 @@ static int exfat_mkdir(struct mnt_idmap *idmap, struct inode *dir,
                goto unlock;
 
        inode_inc_iversion(inode);
-       inode->i_mtime = inode->i_atime = inode->i_ctime =
-               EXFAT_I(inode)->i_crtime = current_time(inode);
+       inode->i_mtime = inode->i_atime = EXFAT_I(inode)->i_crtime = inode_set_ctime_current(inode);
        exfat_truncate_atime(&inode->i_atime);
        /* timestamp is already written, so mark_inode_dirty() is unneeded. */
 
@@ -979,7 +977,7 @@ static int exfat_rmdir(struct inode *dir, struct dentry *dentry)
        ei->dir.dir = DIR_DELETED;
 
        inode_inc_iversion(dir);
-       dir->i_mtime = dir->i_atime = dir->i_ctime = current_time(dir);
+       dir->i_mtime = dir->i_atime = inode_set_ctime_current(dir);
        exfat_truncate_atime(&dir->i_atime);
        if (IS_DIRSYNC(dir))
                exfat_sync_inode(dir);
@@ -988,7 +986,7 @@ static int exfat_rmdir(struct inode *dir, struct dentry *dentry)
        drop_nlink(dir);
 
        clear_nlink(inode);
-       inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
+       inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode);
        exfat_truncate_atime(&inode->i_atime);
        exfat_unhash_inode(inode);
        exfat_d_version_set(dentry, inode_query_iversion(dir));
@@ -1353,8 +1351,7 @@ static int exfat_rename(struct mnt_idmap *idmap,
                        exfat_warn(sb, "abnormal access to an inode dropped");
                        WARN_ON(new_inode->i_nlink == 0);
                }
-               new_inode->i_ctime = EXFAT_I(new_inode)->i_crtime =
-                       current_time(new_inode);
+               EXFAT_I(new_inode)->i_crtime = current_time(new_inode);
        }
 
 unlock:
index 8c32460..8e0ca4b 100644 (file)
@@ -379,8 +379,7 @@ static int exfat_read_root(struct inode *inode)
        ei->i_size_ondisk = i_size_read(inode);
 
        exfat_save_attr(inode, ATTR_SUBDIR);
-       inode->i_mtime = inode->i_atime = inode->i_ctime = ei->i_crtime =
-               current_time(inode);
+       inode->i_mtime = inode->i_atime = ei->i_crtime = inode_set_ctime_current(inode);
        exfat_truncate_atime(&inode->i_atime);
        return 0;
 }