Re: [PATCH 54/79] overlayfs: switch to new ctime accessors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 21, 2023 at 5:54 PM Jeff Layton <jlayton@xxxxxxxxxx> wrote:
>
> In later patches, we're going to change how the ctime.tv_nsec field is
> utilized. Switch to using accessor functions instead of raw accesses of
> inode->i_ctime.
>
> Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>
> ---

Looks ok.

Reviewed-by: Amir Goldstein <amir73il@xxxxxxxxx>

Thanks,
Amir.

>  fs/overlayfs/file.c | 7 +++++--
>  fs/overlayfs/util.c | 2 +-
>  2 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c
> index 21245b00722a..b47013d4bd4e 100644
> --- a/fs/overlayfs/file.c
> +++ b/fs/overlayfs/file.c
> @@ -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 ct, uct;
>
>         if (file->f_flags & O_NOATIME)
>                 return;
> @@ -249,10 +250,12 @@ static void ovl_file_accessed(struct file *file)
>         if (!upperinode)
>                 return;
>
> +       ct = inode_ctime_peek(inode);
> +       uct = inode_ctime_peek(upperinode);
>         if ((!timespec64_equal(&inode->i_mtime, &upperinode->i_mtime) ||
> -            !timespec64_equal(&inode->i_ctime, &upperinode->i_ctime))) {
> +            !timespec64_equal(&ct, &uct))) {
>                 inode->i_mtime = upperinode->i_mtime;
> -               inode->i_ctime = upperinode->i_ctime;
> +               inode_ctime_set(inode, uct);
>         }
>
>         touch_atime(&file->f_path);
> diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c
> index 7ef9e13c404a..e3746f9a202f 100644
> --- a/fs/overlayfs/util.c
> +++ b/fs/overlayfs/util.c
> @@ -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_ctime_set(inode, inode_ctime_peek(realinode));
>         i_size_write(inode, i_size_read(realinode));
>  }
> --
> 2.41.0
>




[Index of Archives]     [Linux Filesystems Devel]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux