exfat: convert to ctime accessor functions
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> Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
This commit is contained in:
parent
c49f06ffab
commit
0e040b023e
8
file.c
8
file.c
@ -30,7 +30,11 @@ static int exfat_cont_expand(struct inode *inode, loff_t size)
|
||||
return err;
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 6, 0)
|
||||
inode->i_mtime = inode_set_ctime_current(inode);
|
||||
#else
|
||||
inode->i_ctime = inode->i_mtime = current_time(inode);
|
||||
#endif
|
||||
#else
|
||||
inode->i_ctime = inode->i_mtime = CURRENT_TIME_SEC;
|
||||
#endif
|
||||
@ -363,7 +367,11 @@ int exfat_setattr(struct dentry *dentry, struct iattr *attr)
|
||||
|
||||
if (attr->ia_valid & ATTR_SIZE)
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 6, 0)
|
||||
inode->i_mtime = inode_set_ctime_current(inode);
|
||||
#else
|
||||
inode->i_mtime = inode->i_ctime = current_time(inode);
|
||||
#endif
|
||||
#else
|
||||
inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
|
||||
#endif
|
||||
|
12
inode.c
12
inode.c
@ -380,7 +380,11 @@ 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));
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 6, 0)
|
||||
inode->i_mtime = inode_set_ctime_current(inode);
|
||||
#else
|
||||
inode->i_mtime = inode->i_ctime = current_time(inode);
|
||||
#endif
|
||||
#else
|
||||
inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
|
||||
#endif
|
||||
@ -438,7 +442,11 @@ static int exfat_write_end(struct file *file, struct address_space *mapping,
|
||||
|
||||
if (!(err < 0) && !(ei->attr & EXFAT_ATTR_ARCHIVE)) {
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 6, 0)
|
||||
inode->i_mtime = inode_set_ctime_current(inode);
|
||||
#else
|
||||
inode->i_mtime = inode->i_ctime = current_time(inode);
|
||||
#endif
|
||||
#else
|
||||
inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
|
||||
#endif
|
||||
@ -659,7 +667,11 @@ 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;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 6, 0)
|
||||
inode_set_ctime_to_ts(inode, info->mtime);
|
||||
#else
|
||||
inode->i_ctime = info->mtime;
|
||||
#endif
|
||||
ei->i_crtime = info->crtime;
|
||||
inode->i_atime = info->atime;
|
||||
|
||||
|
36
namei.c
36
namei.c
@ -625,7 +625,11 @@ static int exfat_create(struct inode *dir, struct dentry *dentry, umode_t mode,
|
||||
dir->i_version++;
|
||||
#endif
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 6, 0)
|
||||
dir->i_mtime = inode_set_ctime_current(dir);
|
||||
#else
|
||||
dir->i_ctime = dir->i_mtime = current_time(dir);
|
||||
#endif
|
||||
#else
|
||||
dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
|
||||
#endif
|
||||
@ -647,8 +651,12 @@ static int exfat_create(struct inode *dir, struct dentry *dentry, umode_t mode,
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 6, 0)
|
||||
inode->i_mtime = inode->i_atime = EXFAT_I(inode)->i_crtime = inode_set_ctime_current(inode);
|
||||
#else
|
||||
inode->i_mtime = inode->i_atime = inode->i_ctime =
|
||||
EXFAT_I(inode)->i_crtime = current_time(inode);
|
||||
#endif
|
||||
#else
|
||||
inode->i_mtime = inode->i_atime = inode->i_ctime =
|
||||
EXFAT_I(inode)->i_crtime = CURRENT_TIME_SEC;
|
||||
@ -903,7 +911,11 @@ static int exfat_unlink(struct inode *dir, struct dentry *dentry)
|
||||
dir->i_version++;
|
||||
#endif
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 6, 0)
|
||||
dir->i_mtime = dir->i_atime = inode_set_ctime_current(dir);
|
||||
#else
|
||||
dir->i_mtime = dir->i_atime = dir->i_ctime = current_time(dir);
|
||||
#endif
|
||||
#else
|
||||
dir->i_mtime = dir->i_atime = dir->i_ctime = CURRENT_TIME_SEC;
|
||||
#endif
|
||||
@ -915,7 +927,11 @@ static int exfat_unlink(struct inode *dir, struct dentry *dentry)
|
||||
|
||||
clear_nlink(inode);
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 6, 0)
|
||||
inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode);
|
||||
#else
|
||||
inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
|
||||
#endif
|
||||
#else
|
||||
inode->i_mtime = inode->i_atime = dir->i_ctime = CURRENT_TIME_SEC;
|
||||
#endif
|
||||
@ -964,7 +980,11 @@ static int exfat_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 6, 0)
|
||||
dir->i_mtime = inode_set_ctime_current(dir);
|
||||
#else
|
||||
dir->i_ctime = dir->i_mtime = current_time(dir);
|
||||
#endif
|
||||
#else
|
||||
dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
|
||||
#endif
|
||||
@ -986,8 +1006,12 @@ static int exfat_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
|
||||
inode->i_version++;
|
||||
#endif
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 6, 0)
|
||||
inode->i_mtime = inode->i_atime = EXFAT_I(inode)->i_crtime = inode_set_ctime_current(inode);
|
||||
#else
|
||||
inode->i_mtime = inode->i_atime = inode->i_ctime =
|
||||
EXFAT_I(inode)->i_crtime = current_time(inode);
|
||||
#endif
|
||||
#else
|
||||
inode->i_mtime = inode->i_atime = inode->i_ctime =
|
||||
EXFAT_I(inode)->i_crtime = CURRENT_TIME_SEC;
|
||||
@ -1111,7 +1135,11 @@ static int exfat_rmdir(struct inode *dir, struct dentry *dentry)
|
||||
dir->i_version++;
|
||||
#endif
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 6, 0)
|
||||
dir->i_mtime = dir->i_atime = inode_set_ctime_current(dir);
|
||||
#else
|
||||
dir->i_mtime = dir->i_atime = dir->i_ctime = current_time(dir);
|
||||
#endif
|
||||
#else
|
||||
dir->i_mtime = dir->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
|
||||
#endif
|
||||
@ -1124,7 +1152,11 @@ static int exfat_rmdir(struct inode *dir, struct dentry *dentry)
|
||||
|
||||
clear_nlink(inode);
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 6, 0)
|
||||
inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode);
|
||||
#else
|
||||
inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
|
||||
#endif
|
||||
#else
|
||||
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
|
||||
#endif
|
||||
@ -1543,8 +1575,12 @@ static int exfat_rename(struct inode *old_dir, struct dentry *old_dentry,
|
||||
WARN_ON(new_inode->i_nlink == 0);
|
||||
}
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 6, 0)
|
||||
EXFAT_I(new_inode)->i_crtime = current_time(new_inode);
|
||||
#else
|
||||
new_inode->i_ctime = EXFAT_I(new_inode)->i_crtime =
|
||||
current_time(new_inode);
|
||||
#endif
|
||||
#else
|
||||
new_inode->i_ctime = EXFAT_I(new_inode)->i_crtime =
|
||||
CURRENT_TIME_SEC;
|
||||
|
4
super.c
4
super.c
@ -651,8 +651,12 @@ static int exfat_read_root(struct inode *inode)
|
||||
|
||||
exfat_save_attr(inode, EXFAT_ATTR_SUBDIR);
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 6, 0)
|
||||
inode->i_mtime = inode->i_atime = ei->i_crtime = inode_set_ctime_current(inode);
|
||||
#else
|
||||
inode->i_mtime = inode->i_atime = inode->i_ctime = ei->i_crtime =
|
||||
current_time(inode);
|
||||
#endif
|
||||
#else
|
||||
inode->i_mtime = inode->i_atime = inode->i_ctime = ei->i_crtime =
|
||||
CURRENT_TIME_SEC;
|
||||
|
Loading…
Reference in New Issue
Block a user