mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-02 00:24:12 +08:00
overlayfs: 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. Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Jeff Layton <jlayton@kernel.org> Reviewed-by: Jan Kara <jack@suse.cz> Message-Id: <20230705190309.579783-64-jlayton@kernel.org> Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
parent
0971a799b1
commit
9aa7111523
@ -239,6 +239,7 @@ static loff_t ovl_llseek(struct file *file, loff_t offset, int whence)
|
||||
static void ovl_file_accessed(struct file *file)
|
||||
{
|
||||
struct inode *inode, *upperinode;
|
||||
struct timespec64 ctime, uctime;
|
||||
|
||||
if (file->f_flags & O_NOATIME)
|
||||
return;
|
||||
@ -249,10 +250,12 @@ static void ovl_file_accessed(struct file *file)
|
||||
if (!upperinode)
|
||||
return;
|
||||
|
||||
ctime = inode_get_ctime(inode);
|
||||
uctime = inode_get_ctime(upperinode);
|
||||
if ((!timespec64_equal(&inode->i_mtime, &upperinode->i_mtime) ||
|
||||
!timespec64_equal(&inode->i_ctime, &upperinode->i_ctime))) {
|
||||
!timespec64_equal(&ctime, &uctime))) {
|
||||
inode->i_mtime = upperinode->i_mtime;
|
||||
inode->i_ctime = upperinode->i_ctime;
|
||||
inode_set_ctime_to_ts(inode, uctime);
|
||||
}
|
||||
|
||||
touch_atime(&file->f_path);
|
||||
|
@ -1202,6 +1202,6 @@ void ovl_copyattr(struct inode *inode)
|
||||
inode->i_mode = realinode->i_mode;
|
||||
inode->i_atime = realinode->i_atime;
|
||||
inode->i_mtime = realinode->i_mtime;
|
||||
inode->i_ctime = realinode->i_ctime;
|
||||
inode_set_ctime_to_ts(inode, inode_get_ctime(realinode));
|
||||
i_size_write(inode, i_size_read(realinode));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user