Re: [PATCH v2 51/92] hpfs: convert to ctime accessor functions

From: Jeff Layton
Date: Thu Jul 06 2023 - 09:11:29 EST


On Thu, 2023-07-06 at 14:47 +0200, Jan Kara wrote:
> On Wed 05-07-23 15:01:16, Jeff Layton wrote:
> > 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@xxxxxxxxxx>
>
> ...
>
> > diff --git a/fs/hpfs/namei.c b/fs/hpfs/namei.c
> > index 69fb40b2c99a..36babb78b510 100644
> > --- a/fs/hpfs/namei.c
> > +++ b/fs/hpfs/namei.c
> > @@ -13,10 +13,10 @@ static void hpfs_update_directory_times(struct inode *dir)
> > {
> > time64_t t = local_to_gmt(dir->i_sb, local_get_seconds(dir->i_sb));
> > if (t == dir->i_mtime.tv_sec &&
> > - t == dir->i_ctime.tv_sec)
> > + t == inode_get_ctime(dir).tv_sec)
> > return;
> > - dir->i_mtime.tv_sec = dir->i_ctime.tv_sec = t;
> > - dir->i_mtime.tv_nsec = dir->i_ctime.tv_nsec = 0;
> > + dir->i_mtime.tv_sec = inode_set_ctime(dir, t, 0).tv_sec;
> > + dir->i_mtime.tv_nsec = 0;
>
> Easier to read:
>
> dir->i_mtime = inode_set_ctime(dir, t, 0);
>
> > @@ -59,8 +59,9 @@ static int hpfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
> > result->i_ino = fno;
> > hpfs_i(result)->i_parent_dir = dir->i_ino;
> > hpfs_i(result)->i_dno = dno;
> > - result->i_ctime.tv_sec = result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date));
> > - result->i_ctime.tv_nsec = 0;
> > + inode_set_ctime(result,
> > + result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)),
> > + 0);
> > result->i_mtime.tv_nsec = 0;
> > result->i_atime.tv_nsec = 0;
>
> Here also:
> result->i_mtime = result->i_atime = inode_set_ctime(result,
> local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)), 0)
>
> > @@ -167,8 +168,9 @@ static int hpfs_create(struct mnt_idmap *idmap, struct inode *dir,
> > result->i_fop = &hpfs_file_ops;
> > set_nlink(result, 1);
> > hpfs_i(result)->i_parent_dir = dir->i_ino;
> > - result->i_ctime.tv_sec = result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date));
> > - result->i_ctime.tv_nsec = 0;
> > + inode_set_ctime(result,
> > + result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)),
> > + 0);
> > result->i_mtime.tv_nsec = 0;
> > result->i_atime.tv_nsec = 0;
>
> And here exactly the same.
>
> > @@ -250,8 +252,9 @@ static int hpfs_mknod(struct mnt_idmap *idmap, struct inode *dir,
> > hpfs_init_inode(result);
> > result->i_ino = fno;
> > hpfs_i(result)->i_parent_dir = dir->i_ino;
> > - result->i_ctime.tv_sec = result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date));
> > - result->i_ctime.tv_nsec = 0;
> > + inode_set_ctime(result,
> > + result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)),
> > + 0);
> > result->i_mtime.tv_nsec = 0;
> > result->i_atime.tv_nsec = 0;
> > hpfs_i(result)->i_ea_size = 0;
> > @@ -326,8 +329,9 @@ static int hpfs_symlink(struct mnt_idmap *idmap, struct inode *dir,
> > result->i_ino = fno;
> > hpfs_init_inode(result);
> > hpfs_i(result)->i_parent_dir = dir->i_ino;
> > - result->i_ctime.tv_sec = result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date));
> > - result->i_ctime.tv_nsec = 0;
> > + inode_set_ctime(result,
> > + result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)),
> > + 0);
> > result->i_mtime.tv_nsec = 0;
> > result->i_atime.tv_nsec = 0;
> > hpfs_i(result)->i_ea_size = 0;
>
> And in above two as well.
>
> Honza

Thanks. I fixed those up in my tree.
--
Jeff Layton <jlayton@xxxxxxxxxx>