* [PATCH 10/79] affs: switch to new ctime accessors
[not found] ` <20230621144735.55953-1-jlayton@kernel.org>
@ 2023-06-21 14:45 ` Jeff Layton
2023-06-21 16:39 ` Jan Kara
2023-06-22 11:37 ` David Sterba
2023-06-21 14:45 ` [PATCH 12/79] fs: " Jeff Layton
` (9 subsequent siblings)
10 siblings, 2 replies; 24+ messages in thread
From: Jeff Layton @ 2023-06-21 14:45 UTC (permalink / raw)
To: Christian Brauner, David Sterba
Cc: Al Viro, Jan Kara, linux-fsdevel, linux-kernel
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@kernel.org>
---
fs/affs/amigaffs.c | 6 +++---
fs/affs/inode.c | 17 +++++++++--------
2 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/fs/affs/amigaffs.c b/fs/affs/amigaffs.c
index 29f11e10a7c7..2b508aa6707e 100644
--- a/fs/affs/amigaffs.c
+++ b/fs/affs/amigaffs.c
@@ -60,7 +60,7 @@ affs_insert_hash(struct inode *dir, struct buffer_head *bh)
mark_buffer_dirty_inode(dir_bh, dir);
affs_brelse(dir_bh);
- dir->i_mtime = dir->i_ctime = current_time(dir);
+ dir->i_mtime = inode_ctime_set_current(dir);
inode_inc_iversion(dir);
mark_inode_dirty(dir);
@@ -114,7 +114,7 @@ affs_remove_hash(struct inode *dir, struct buffer_head *rem_bh)
affs_brelse(bh);
- dir->i_mtime = dir->i_ctime = current_time(dir);
+ dir->i_mtime = inode_ctime_set_current(dir);
inode_inc_iversion(dir);
mark_inode_dirty(dir);
@@ -315,7 +315,7 @@ affs_remove_header(struct dentry *dentry)
else
clear_nlink(inode);
affs_unlock_link(inode);
- inode->i_ctime = current_time(inode);
+ inode_ctime_set_current(inode);
mark_inode_dirty(inode);
done:
diff --git a/fs/affs/inode.c b/fs/affs/inode.c
index 27f77a52c5c8..177bac4def5e 100644
--- a/fs/affs/inode.c
+++ b/fs/affs/inode.c
@@ -19,6 +19,7 @@ struct inode *affs_iget(struct super_block *sb, unsigned long ino)
{
struct affs_sb_info *sbi = AFFS_SB(sb);
struct buffer_head *bh;
+ struct timespec64 ctime;
struct affs_tail *tail;
struct inode *inode;
u32 block;
@@ -149,13 +150,13 @@ struct inode *affs_iget(struct super_block *sb, unsigned long ino)
break;
}
- inode->i_mtime.tv_sec = inode->i_atime.tv_sec = inode->i_ctime.tv_sec
- = (be32_to_cpu(tail->change.days) * 86400LL +
- be32_to_cpu(tail->change.mins) * 60 +
- be32_to_cpu(tail->change.ticks) / 50 +
- AFFS_EPOCH_DELTA) +
- sys_tz.tz_minuteswest * 60;
- inode->i_mtime.tv_nsec = inode->i_ctime.tv_nsec = inode->i_atime.tv_nsec = 0;
+ ctime.tv_sec = (be32_to_cpu(tail->change.days) * 86400LL +
+ be32_to_cpu(tail->change.mins) * 60 +
+ be32_to_cpu(tail->change.ticks) / 50 +
+ AFFS_EPOCH_DELTA) +
+ sys_tz.tz_minuteswest * 60;
+ ctime.tv_nsec = 0;
+ inode->i_atime = inode->i_mtime = inode_ctime_set(inode, ctime);
affs_brelse(bh);
unlock_new_inode(inode);
return inode;
@@ -314,7 +315,7 @@ affs_new_inode(struct inode *dir)
inode->i_gid = current_fsgid();
inode->i_ino = block;
set_nlink(inode, 1);
- inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
+ inode->i_mtime = inode->i_atime = inode_ctime_set_current(inode);
atomic_set(&AFFS_I(inode)->i_opencnt, 0);
AFFS_I(inode)->i_blkcnt = 0;
AFFS_I(inode)->i_lc = NULL;
--
2.41.0
^ permalink raw reply related [flat|nested] 24+ messages in thread* Re: [PATCH 10/79] affs: switch to new ctime accessors
2023-06-21 14:45 ` [PATCH 10/79] affs: switch to new ctime accessors Jeff Layton
@ 2023-06-21 16:39 ` Jan Kara
2023-06-22 11:37 ` David Sterba
1 sibling, 0 replies; 24+ messages in thread
From: Jan Kara @ 2023-06-21 16:39 UTC (permalink / raw)
To: Jeff Layton
Cc: Christian Brauner, David Sterba, Al Viro, Jan Kara, linux-fsdevel,
linux-kernel
On Wed 21-06-23 10:45:23, Jeff Layton 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@kernel.org>
Looks good to me. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/affs/amigaffs.c | 6 +++---
> fs/affs/inode.c | 17 +++++++++--------
> 2 files changed, 12 insertions(+), 11 deletions(-)
>
> diff --git a/fs/affs/amigaffs.c b/fs/affs/amigaffs.c
> index 29f11e10a7c7..2b508aa6707e 100644
> --- a/fs/affs/amigaffs.c
> +++ b/fs/affs/amigaffs.c
> @@ -60,7 +60,7 @@ affs_insert_hash(struct inode *dir, struct buffer_head *bh)
> mark_buffer_dirty_inode(dir_bh, dir);
> affs_brelse(dir_bh);
>
> - dir->i_mtime = dir->i_ctime = current_time(dir);
> + dir->i_mtime = inode_ctime_set_current(dir);
> inode_inc_iversion(dir);
> mark_inode_dirty(dir);
>
> @@ -114,7 +114,7 @@ affs_remove_hash(struct inode *dir, struct buffer_head *rem_bh)
>
> affs_brelse(bh);
>
> - dir->i_mtime = dir->i_ctime = current_time(dir);
> + dir->i_mtime = inode_ctime_set_current(dir);
> inode_inc_iversion(dir);
> mark_inode_dirty(dir);
>
> @@ -315,7 +315,7 @@ affs_remove_header(struct dentry *dentry)
> else
> clear_nlink(inode);
> affs_unlock_link(inode);
> - inode->i_ctime = current_time(inode);
> + inode_ctime_set_current(inode);
> mark_inode_dirty(inode);
>
> done:
> diff --git a/fs/affs/inode.c b/fs/affs/inode.c
> index 27f77a52c5c8..177bac4def5e 100644
> --- a/fs/affs/inode.c
> +++ b/fs/affs/inode.c
> @@ -19,6 +19,7 @@ struct inode *affs_iget(struct super_block *sb, unsigned long ino)
> {
> struct affs_sb_info *sbi = AFFS_SB(sb);
> struct buffer_head *bh;
> + struct timespec64 ctime;
> struct affs_tail *tail;
> struct inode *inode;
> u32 block;
> @@ -149,13 +150,13 @@ struct inode *affs_iget(struct super_block *sb, unsigned long ino)
> break;
> }
>
> - inode->i_mtime.tv_sec = inode->i_atime.tv_sec = inode->i_ctime.tv_sec
> - = (be32_to_cpu(tail->change.days) * 86400LL +
> - be32_to_cpu(tail->change.mins) * 60 +
> - be32_to_cpu(tail->change.ticks) / 50 +
> - AFFS_EPOCH_DELTA) +
> - sys_tz.tz_minuteswest * 60;
> - inode->i_mtime.tv_nsec = inode->i_ctime.tv_nsec = inode->i_atime.tv_nsec = 0;
> + ctime.tv_sec = (be32_to_cpu(tail->change.days) * 86400LL +
> + be32_to_cpu(tail->change.mins) * 60 +
> + be32_to_cpu(tail->change.ticks) / 50 +
> + AFFS_EPOCH_DELTA) +
> + sys_tz.tz_minuteswest * 60;
> + ctime.tv_nsec = 0;
> + inode->i_atime = inode->i_mtime = inode_ctime_set(inode, ctime);
> affs_brelse(bh);
> unlock_new_inode(inode);
> return inode;
> @@ -314,7 +315,7 @@ affs_new_inode(struct inode *dir)
> inode->i_gid = current_fsgid();
> inode->i_ino = block;
> set_nlink(inode, 1);
> - inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
> + inode->i_mtime = inode->i_atime = inode_ctime_set_current(inode);
> atomic_set(&AFFS_I(inode)->i_opencnt, 0);
> AFFS_I(inode)->i_blkcnt = 0;
> AFFS_I(inode)->i_lc = NULL;
> --
> 2.41.0
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 24+ messages in thread* Re: [PATCH 10/79] affs: switch to new ctime accessors
2023-06-21 14:45 ` [PATCH 10/79] affs: switch to new ctime accessors Jeff Layton
2023-06-21 16:39 ` Jan Kara
@ 2023-06-22 11:37 ` David Sterba
1 sibling, 0 replies; 24+ messages in thread
From: David Sterba @ 2023-06-22 11:37 UTC (permalink / raw)
To: Jeff Layton
Cc: Christian Brauner, David Sterba, Al Viro, Jan Kara, linux-fsdevel,
linux-kernel
On Wed, Jun 21, 2023 at 10:45:23AM -0400, Jeff Layton 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@kernel.org>
Acked-by: David Sterba <dsterba@suse.com>
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH 12/79] fs: switch to new ctime accessors
[not found] ` <20230621144735.55953-1-jlayton@kernel.org>
2023-06-21 14:45 ` [PATCH 10/79] affs: switch to new ctime accessors Jeff Layton
@ 2023-06-21 14:45 ` Jeff Layton
2023-06-21 16:42 ` Jan Kara
2023-06-21 14:45 ` [PATCH 27/79] exfat: " Jeff Layton
` (8 subsequent siblings)
10 siblings, 1 reply; 24+ messages in thread
From: Jeff Layton @ 2023-06-21 14:45 UTC (permalink / raw)
To: Christian Brauner, Alexander Viro, Eric Biederman, Kees Cook
Cc: Jan Kara, linux-fsdevel, linux-kernel, linux-mm
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@kernel.org>
---
fs/attr.c | 2 +-
fs/bad_inode.c | 3 +--
fs/binfmt_misc.c | 3 +--
fs/inode.c | 12 ++++++++----
fs/libfs.c | 32 +++++++++++++++++---------------
fs/nsfs.c | 2 +-
fs/pipe.c | 2 +-
fs/posix_acl.c | 2 +-
fs/stack.c | 2 +-
fs/stat.c | 2 +-
include/linux/fs_stack.h | 2 +-
11 files changed, 34 insertions(+), 30 deletions(-)
diff --git a/fs/attr.c b/fs/attr.c
index d60dc1edb526..2750e5f98dfb 100644
--- a/fs/attr.c
+++ b/fs/attr.c
@@ -312,7 +312,7 @@ void setattr_copy(struct mnt_idmap *idmap, struct inode *inode,
if (ia_valid & ATTR_MTIME)
inode->i_mtime = attr->ia_mtime;
if (ia_valid & ATTR_CTIME)
- inode->i_ctime = attr->ia_ctime;
+ inode_ctime_set(inode, attr->ia_ctime);
if (ia_valid & ATTR_MODE) {
umode_t mode = attr->ia_mode;
if (!in_group_or_capable(idmap, inode,
diff --git a/fs/bad_inode.c b/fs/bad_inode.c
index db649487d58c..bd3762e1b670 100644
--- a/fs/bad_inode.c
+++ b/fs/bad_inode.c
@@ -209,8 +209,7 @@ void make_bad_inode(struct inode *inode)
remove_inode_hash(inode);
inode->i_mode = S_IFREG;
- inode->i_atime = inode->i_mtime = inode->i_ctime =
- current_time(inode);
+ inode->i_atime = inode->i_mtime = inode_ctime_set_current(inode);
inode->i_op = &bad_inode_ops;
inode->i_opflags &= ~IOP_XATTR;
inode->i_fop = &bad_file_ops;
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index bb202ad369d5..6af92eb1b871 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -547,8 +547,7 @@ static struct inode *bm_get_inode(struct super_block *sb, int mode)
if (inode) {
inode->i_ino = get_next_ino();
inode->i_mode = mode;
- inode->i_atime = inode->i_mtime = inode->i_ctime =
- current_time(inode);
+ inode->i_atime = inode->i_mtime = inode_ctime_set_current(inode);
}
return inode;
}
diff --git a/fs/inode.c b/fs/inode.c
index c005e7328fbb..a7f484e9e7c1 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -1851,6 +1851,7 @@ EXPORT_SYMBOL(bmap);
static int relatime_need_update(struct vfsmount *mnt, struct inode *inode,
struct timespec64 now)
{
+ struct timespec64 ctime;
if (!(mnt->mnt_flags & MNT_RELATIME))
return 1;
@@ -1862,7 +1863,8 @@ static int relatime_need_update(struct vfsmount *mnt, struct inode *inode,
/*
* Is ctime younger than or equal to atime? If yes, update atime:
*/
- if (timespec64_compare(&inode->i_ctime, &inode->i_atime) >= 0)
+ ctime = inode_ctime_peek(inode);
+ if (timespec64_compare(&ctime, &inode->i_atime) >= 0)
return 1;
/*
@@ -1885,7 +1887,7 @@ int generic_update_time(struct inode *inode, struct timespec64 *time, int flags)
if (flags & S_ATIME)
inode->i_atime = *time;
if (flags & S_CTIME)
- inode->i_ctime = *time;
+ inode_ctime_set(inode, *time);
if (flags & S_MTIME)
inode->i_mtime = *time;
@@ -2071,6 +2073,7 @@ EXPORT_SYMBOL(file_remove_privs);
static int inode_needs_update_time(struct inode *inode, struct timespec64 *now)
{
int sync_it = 0;
+ struct timespec64 ctime;
/* First try to exhaust all avenues to not sync */
if (IS_NOCMTIME(inode))
@@ -2079,7 +2082,8 @@ static int inode_needs_update_time(struct inode *inode, struct timespec64 *now)
if (!timespec64_equal(&inode->i_mtime, now))
sync_it = S_MTIME;
- if (!timespec64_equal(&inode->i_ctime, now))
+ ctime = inode_ctime_peek(inode);
+ if (!timespec64_equal(&ctime, now))
sync_it |= S_CTIME;
if (IS_I_VERSION(inode) && inode_iversion_need_inc(inode))
@@ -2510,7 +2514,7 @@ struct timespec64 inode_ctime_set_current(struct inode *inode)
{
struct timespec64 now = current_time(inode);
- inode_set_ctime(inode, now);
+ inode_ctime_set(inode, now);
return now;
}
EXPORT_SYMBOL(inode_ctime_set_current);
diff --git a/fs/libfs.c b/fs/libfs.c
index 5b851315eeed..4a914f09fa87 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -275,7 +275,7 @@ void simple_recursive_removal(struct dentry *dentry,
while ((child = find_next_child(this, victim)) == NULL) {
// kill and ascend
// update metadata while it's still locked
- inode->i_ctime = current_time(inode);
+ inode_ctime_set_current(inode);
clear_nlink(inode);
inode_unlock(inode);
victim = this;
@@ -293,8 +293,7 @@ void simple_recursive_removal(struct dentry *dentry,
dput(victim); // unpin it
}
if (victim == dentry) {
- inode->i_ctime = inode->i_mtime =
- current_time(inode);
+ inode->i_mtime = inode_ctime_set_current(inode);
if (d_is_dir(dentry))
drop_nlink(inode);
inode_unlock(inode);
@@ -335,7 +334,7 @@ static int pseudo_fs_fill_super(struct super_block *s, struct fs_context *fc)
*/
root->i_ino = 1;
root->i_mode = S_IFDIR | S_IRUSR | S_IWUSR;
- root->i_atime = root->i_mtime = root->i_ctime = current_time(root);
+ root->i_atime = root->i_mtime = inode_ctime_set_current(root);
s->s_root = d_make_root(root);
if (!s->s_root)
return -ENOMEM;
@@ -391,7 +390,8 @@ int simple_link(struct dentry *old_dentry, struct inode *dir, struct dentry *den
{
struct inode *inode = d_inode(old_dentry);
- inode->i_ctime = dir->i_ctime = dir->i_mtime = current_time(inode);
+ inode_ctime_set_current(inode);
+ inode->i_mtime = inode_ctime_set_current(dir);
inc_nlink(inode);
ihold(inode);
dget(dentry);
@@ -425,7 +425,8 @@ int simple_unlink(struct inode *dir, struct dentry *dentry)
{
struct inode *inode = d_inode(dentry);
- inode->i_ctime = dir->i_ctime = dir->i_mtime = current_time(inode);
+ inode_ctime_set_current(inode);
+ dir->i_mtime = inode_ctime_set_current(dir);
drop_nlink(inode);
dput(dentry);
return 0;
@@ -459,10 +460,10 @@ int simple_rename_exchange(struct inode *old_dir, struct dentry *old_dentry,
inc_nlink(old_dir);
}
}
- old_dir->i_ctime = old_dir->i_mtime =
- new_dir->i_ctime = new_dir->i_mtime =
- d_inode(old_dentry)->i_ctime =
- d_inode(new_dentry)->i_ctime = current_time(old_dir);
+ old_dir->i_mtime = inode_ctime_set_current(old_dir);
+ new_dir->i_mtime = inode_ctime_set_current(new_dir);
+ inode_ctime_set_current(d_inode(old_dentry));
+ inode_ctime_set_current(d_inode(new_dentry));
return 0;
}
@@ -495,8 +496,9 @@ int simple_rename(struct mnt_idmap *idmap, struct inode *old_dir,
inc_nlink(new_dir);
}
- old_dir->i_ctime = old_dir->i_mtime = new_dir->i_ctime =
- new_dir->i_mtime = inode->i_ctime = current_time(old_dir);
+ old_dir->i_mtime = inode_ctime_set_current(old_dir);
+ new_dir->i_mtime = inode_ctime_set_current(new_dir);
+ inode_ctime_set_current(inode);
return 0;
}
@@ -659,7 +661,7 @@ int simple_fill_super(struct super_block *s, unsigned long magic,
*/
inode->i_ino = 1;
inode->i_mode = S_IFDIR | 0755;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
+ inode->i_atime = inode->i_mtime = inode_ctime_set_current(inode);
inode->i_op = &simple_dir_inode_operations;
inode->i_fop = &simple_dir_operations;
set_nlink(inode, 2);
@@ -685,7 +687,7 @@ int simple_fill_super(struct super_block *s, unsigned long magic,
goto out;
}
inode->i_mode = S_IFREG | files->mode;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
+ inode->i_atime = inode->i_mtime = inode_ctime_set_current(inode);
inode->i_fop = files->ops;
inode->i_ino = i;
d_add(dentry, inode);
@@ -1253,7 +1255,7 @@ struct inode *alloc_anon_inode(struct super_block *s)
inode->i_uid = current_fsuid();
inode->i_gid = current_fsgid();
inode->i_flags |= S_PRIVATE;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
+ inode->i_atime = inode->i_mtime = inode_ctime_set_current(inode);
return inode;
}
EXPORT_SYMBOL(alloc_anon_inode);
diff --git a/fs/nsfs.c b/fs/nsfs.c
index f602a96a1afe..c052cc55eacd 100644
--- a/fs/nsfs.c
+++ b/fs/nsfs.c
@@ -84,7 +84,7 @@ static int __ns_get_path(struct path *path, struct ns_common *ns)
return -ENOMEM;
}
inode->i_ino = ns->inum;
- inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
+ inode->i_mtime = inode->i_atime = inode_ctime_set_current(inode);
inode->i_flags |= S_IMMUTABLE;
inode->i_mode = S_IFREG | S_IRUGO;
inode->i_fop = &ns_file_operations;
diff --git a/fs/pipe.c b/fs/pipe.c
index 2d88f73f585a..bb90b6fc4a96 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -899,7 +899,7 @@ static struct inode * get_pipe_inode(void)
inode->i_mode = S_IFIFO | S_IRUSR | S_IWUSR;
inode->i_uid = current_fsuid();
inode->i_gid = current_fsgid();
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
+ inode->i_atime = inode->i_mtime = inode_ctime_set_current(inode);
return inode;
diff --git a/fs/posix_acl.c b/fs/posix_acl.c
index 7fa1b738bbab..cc9c390fd2af 100644
--- a/fs/posix_acl.c
+++ b/fs/posix_acl.c
@@ -1027,7 +1027,7 @@ int simple_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
return error;
}
- inode->i_ctime = current_time(inode);
+ inode_ctime_set_current(inode);
if (IS_I_VERSION(inode))
inode_inc_iversion(inode);
set_cached_acl(inode, type, acl);
diff --git a/fs/stack.c b/fs/stack.c
index c9830924eb12..efd0de85bace 100644
--- a/fs/stack.c
+++ b/fs/stack.c
@@ -68,7 +68,7 @@ void fsstack_copy_attr_all(struct inode *dest, const struct inode *src)
dest->i_rdev = src->i_rdev;
dest->i_atime = src->i_atime;
dest->i_mtime = src->i_mtime;
- dest->i_ctime = src->i_ctime;
+ inode_ctime_set(dest, inode_ctime_peek(src));
dest->i_blkbits = src->i_blkbits;
dest->i_flags = src->i_flags;
set_nlink(dest, src->i_nlink);
diff --git a/fs/stat.c b/fs/stat.c
index 7c238da22ef0..5d87e34d6dd5 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -58,7 +58,7 @@ void generic_fillattr(struct mnt_idmap *idmap, struct inode *inode,
stat->size = i_size_read(inode);
stat->atime = inode->i_atime;
stat->mtime = inode->i_mtime;
- stat->ctime = inode->i_ctime;
+ stat->ctime = inode_ctime_peek(inode);
stat->blksize = i_blocksize(inode);
stat->blocks = inode->i_blocks;
}
diff --git a/include/linux/fs_stack.h b/include/linux/fs_stack.h
index 54210a42c30d..1488a118fe91 100644
--- a/include/linux/fs_stack.h
+++ b/include/linux/fs_stack.h
@@ -24,7 +24,7 @@ static inline void fsstack_copy_attr_times(struct inode *dest,
{
dest->i_atime = src->i_atime;
dest->i_mtime = src->i_mtime;
- dest->i_ctime = src->i_ctime;
+ inode_ctime_set(dest, inode_ctime_peek(src));
}
#endif /* _LINUX_FS_STACK_H */
--
2.41.0
^ permalink raw reply related [flat|nested] 24+ messages in thread* Re: [PATCH 12/79] fs: switch to new ctime accessors
2023-06-21 14:45 ` [PATCH 12/79] fs: " Jeff Layton
@ 2023-06-21 16:42 ` Jan Kara
0 siblings, 0 replies; 24+ messages in thread
From: Jan Kara @ 2023-06-21 16:42 UTC (permalink / raw)
To: Jeff Layton
Cc: Christian Brauner, Alexander Viro, Eric Biederman, Kees Cook,
Jan Kara, linux-fsdevel, linux-kernel, linux-mm
On Wed 21-06-23 10:45:25, Jeff Layton 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@kernel.org>
Looks good to me. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/attr.c | 2 +-
> fs/bad_inode.c | 3 +--
> fs/binfmt_misc.c | 3 +--
> fs/inode.c | 12 ++++++++----
> fs/libfs.c | 32 +++++++++++++++++---------------
> fs/nsfs.c | 2 +-
> fs/pipe.c | 2 +-
> fs/posix_acl.c | 2 +-
> fs/stack.c | 2 +-
> fs/stat.c | 2 +-
> include/linux/fs_stack.h | 2 +-
> 11 files changed, 34 insertions(+), 30 deletions(-)
>
> diff --git a/fs/attr.c b/fs/attr.c
> index d60dc1edb526..2750e5f98dfb 100644
> --- a/fs/attr.c
> +++ b/fs/attr.c
> @@ -312,7 +312,7 @@ void setattr_copy(struct mnt_idmap *idmap, struct inode *inode,
> if (ia_valid & ATTR_MTIME)
> inode->i_mtime = attr->ia_mtime;
> if (ia_valid & ATTR_CTIME)
> - inode->i_ctime = attr->ia_ctime;
> + inode_ctime_set(inode, attr->ia_ctime);
> if (ia_valid & ATTR_MODE) {
> umode_t mode = attr->ia_mode;
> if (!in_group_or_capable(idmap, inode,
> diff --git a/fs/bad_inode.c b/fs/bad_inode.c
> index db649487d58c..bd3762e1b670 100644
> --- a/fs/bad_inode.c
> +++ b/fs/bad_inode.c
> @@ -209,8 +209,7 @@ void make_bad_inode(struct inode *inode)
> remove_inode_hash(inode);
>
> inode->i_mode = S_IFREG;
> - inode->i_atime = inode->i_mtime = inode->i_ctime =
> - current_time(inode);
> + inode->i_atime = inode->i_mtime = inode_ctime_set_current(inode);
> inode->i_op = &bad_inode_ops;
> inode->i_opflags &= ~IOP_XATTR;
> inode->i_fop = &bad_file_ops;
> diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
> index bb202ad369d5..6af92eb1b871 100644
> --- a/fs/binfmt_misc.c
> +++ b/fs/binfmt_misc.c
> @@ -547,8 +547,7 @@ static struct inode *bm_get_inode(struct super_block *sb, int mode)
> if (inode) {
> inode->i_ino = get_next_ino();
> inode->i_mode = mode;
> - inode->i_atime = inode->i_mtime = inode->i_ctime =
> - current_time(inode);
> + inode->i_atime = inode->i_mtime = inode_ctime_set_current(inode);
> }
> return inode;
> }
> diff --git a/fs/inode.c b/fs/inode.c
> index c005e7328fbb..a7f484e9e7c1 100644
> --- a/fs/inode.c
> +++ b/fs/inode.c
> @@ -1851,6 +1851,7 @@ EXPORT_SYMBOL(bmap);
> static int relatime_need_update(struct vfsmount *mnt, struct inode *inode,
> struct timespec64 now)
> {
> + struct timespec64 ctime;
>
> if (!(mnt->mnt_flags & MNT_RELATIME))
> return 1;
> @@ -1862,7 +1863,8 @@ static int relatime_need_update(struct vfsmount *mnt, struct inode *inode,
> /*
> * Is ctime younger than or equal to atime? If yes, update atime:
> */
> - if (timespec64_compare(&inode->i_ctime, &inode->i_atime) >= 0)
> + ctime = inode_ctime_peek(inode);
> + if (timespec64_compare(&ctime, &inode->i_atime) >= 0)
> return 1;
>
> /*
> @@ -1885,7 +1887,7 @@ int generic_update_time(struct inode *inode, struct timespec64 *time, int flags)
> if (flags & S_ATIME)
> inode->i_atime = *time;
> if (flags & S_CTIME)
> - inode->i_ctime = *time;
> + inode_ctime_set(inode, *time);
> if (flags & S_MTIME)
> inode->i_mtime = *time;
>
> @@ -2071,6 +2073,7 @@ EXPORT_SYMBOL(file_remove_privs);
> static int inode_needs_update_time(struct inode *inode, struct timespec64 *now)
> {
> int sync_it = 0;
> + struct timespec64 ctime;
>
> /* First try to exhaust all avenues to not sync */
> if (IS_NOCMTIME(inode))
> @@ -2079,7 +2082,8 @@ static int inode_needs_update_time(struct inode *inode, struct timespec64 *now)
> if (!timespec64_equal(&inode->i_mtime, now))
> sync_it = S_MTIME;
>
> - if (!timespec64_equal(&inode->i_ctime, now))
> + ctime = inode_ctime_peek(inode);
> + if (!timespec64_equal(&ctime, now))
> sync_it |= S_CTIME;
>
> if (IS_I_VERSION(inode) && inode_iversion_need_inc(inode))
> @@ -2510,7 +2514,7 @@ struct timespec64 inode_ctime_set_current(struct inode *inode)
> {
> struct timespec64 now = current_time(inode);
>
> - inode_set_ctime(inode, now);
> + inode_ctime_set(inode, now);
> return now;
> }
> EXPORT_SYMBOL(inode_ctime_set_current);
> diff --git a/fs/libfs.c b/fs/libfs.c
> index 5b851315eeed..4a914f09fa87 100644
> --- a/fs/libfs.c
> +++ b/fs/libfs.c
> @@ -275,7 +275,7 @@ void simple_recursive_removal(struct dentry *dentry,
> while ((child = find_next_child(this, victim)) == NULL) {
> // kill and ascend
> // update metadata while it's still locked
> - inode->i_ctime = current_time(inode);
> + inode_ctime_set_current(inode);
> clear_nlink(inode);
> inode_unlock(inode);
> victim = this;
> @@ -293,8 +293,7 @@ void simple_recursive_removal(struct dentry *dentry,
> dput(victim); // unpin it
> }
> if (victim == dentry) {
> - inode->i_ctime = inode->i_mtime =
> - current_time(inode);
> + inode->i_mtime = inode_ctime_set_current(inode);
> if (d_is_dir(dentry))
> drop_nlink(inode);
> inode_unlock(inode);
> @@ -335,7 +334,7 @@ static int pseudo_fs_fill_super(struct super_block *s, struct fs_context *fc)
> */
> root->i_ino = 1;
> root->i_mode = S_IFDIR | S_IRUSR | S_IWUSR;
> - root->i_atime = root->i_mtime = root->i_ctime = current_time(root);
> + root->i_atime = root->i_mtime = inode_ctime_set_current(root);
> s->s_root = d_make_root(root);
> if (!s->s_root)
> return -ENOMEM;
> @@ -391,7 +390,8 @@ int simple_link(struct dentry *old_dentry, struct inode *dir, struct dentry *den
> {
> struct inode *inode = d_inode(old_dentry);
>
> - inode->i_ctime = dir->i_ctime = dir->i_mtime = current_time(inode);
> + inode_ctime_set_current(inode);
> + inode->i_mtime = inode_ctime_set_current(dir);
> inc_nlink(inode);
> ihold(inode);
> dget(dentry);
> @@ -425,7 +425,8 @@ int simple_unlink(struct inode *dir, struct dentry *dentry)
> {
> struct inode *inode = d_inode(dentry);
>
> - inode->i_ctime = dir->i_ctime = dir->i_mtime = current_time(inode);
> + inode_ctime_set_current(inode);
> + dir->i_mtime = inode_ctime_set_current(dir);
> drop_nlink(inode);
> dput(dentry);
> return 0;
> @@ -459,10 +460,10 @@ int simple_rename_exchange(struct inode *old_dir, struct dentry *old_dentry,
> inc_nlink(old_dir);
> }
> }
> - old_dir->i_ctime = old_dir->i_mtime =
> - new_dir->i_ctime = new_dir->i_mtime =
> - d_inode(old_dentry)->i_ctime =
> - d_inode(new_dentry)->i_ctime = current_time(old_dir);
> + old_dir->i_mtime = inode_ctime_set_current(old_dir);
> + new_dir->i_mtime = inode_ctime_set_current(new_dir);
> + inode_ctime_set_current(d_inode(old_dentry));
> + inode_ctime_set_current(d_inode(new_dentry));
>
> return 0;
> }
> @@ -495,8 +496,9 @@ int simple_rename(struct mnt_idmap *idmap, struct inode *old_dir,
> inc_nlink(new_dir);
> }
>
> - old_dir->i_ctime = old_dir->i_mtime = new_dir->i_ctime =
> - new_dir->i_mtime = inode->i_ctime = current_time(old_dir);
> + old_dir->i_mtime = inode_ctime_set_current(old_dir);
> + new_dir->i_mtime = inode_ctime_set_current(new_dir);
> + inode_ctime_set_current(inode);
>
> return 0;
> }
> @@ -659,7 +661,7 @@ int simple_fill_super(struct super_block *s, unsigned long magic,
> */
> inode->i_ino = 1;
> inode->i_mode = S_IFDIR | 0755;
> - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
> + inode->i_atime = inode->i_mtime = inode_ctime_set_current(inode);
> inode->i_op = &simple_dir_inode_operations;
> inode->i_fop = &simple_dir_operations;
> set_nlink(inode, 2);
> @@ -685,7 +687,7 @@ int simple_fill_super(struct super_block *s, unsigned long magic,
> goto out;
> }
> inode->i_mode = S_IFREG | files->mode;
> - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
> + inode->i_atime = inode->i_mtime = inode_ctime_set_current(inode);
> inode->i_fop = files->ops;
> inode->i_ino = i;
> d_add(dentry, inode);
> @@ -1253,7 +1255,7 @@ struct inode *alloc_anon_inode(struct super_block *s)
> inode->i_uid = current_fsuid();
> inode->i_gid = current_fsgid();
> inode->i_flags |= S_PRIVATE;
> - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
> + inode->i_atime = inode->i_mtime = inode_ctime_set_current(inode);
> return inode;
> }
> EXPORT_SYMBOL(alloc_anon_inode);
> diff --git a/fs/nsfs.c b/fs/nsfs.c
> index f602a96a1afe..c052cc55eacd 100644
> --- a/fs/nsfs.c
> +++ b/fs/nsfs.c
> @@ -84,7 +84,7 @@ static int __ns_get_path(struct path *path, struct ns_common *ns)
> return -ENOMEM;
> }
> inode->i_ino = ns->inum;
> - inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
> + inode->i_mtime = inode->i_atime = inode_ctime_set_current(inode);
> inode->i_flags |= S_IMMUTABLE;
> inode->i_mode = S_IFREG | S_IRUGO;
> inode->i_fop = &ns_file_operations;
> diff --git a/fs/pipe.c b/fs/pipe.c
> index 2d88f73f585a..bb90b6fc4a96 100644
> --- a/fs/pipe.c
> +++ b/fs/pipe.c
> @@ -899,7 +899,7 @@ static struct inode * get_pipe_inode(void)
> inode->i_mode = S_IFIFO | S_IRUSR | S_IWUSR;
> inode->i_uid = current_fsuid();
> inode->i_gid = current_fsgid();
> - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
> + inode->i_atime = inode->i_mtime = inode_ctime_set_current(inode);
>
> return inode;
>
> diff --git a/fs/posix_acl.c b/fs/posix_acl.c
> index 7fa1b738bbab..cc9c390fd2af 100644
> --- a/fs/posix_acl.c
> +++ b/fs/posix_acl.c
> @@ -1027,7 +1027,7 @@ int simple_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
> return error;
> }
>
> - inode->i_ctime = current_time(inode);
> + inode_ctime_set_current(inode);
> if (IS_I_VERSION(inode))
> inode_inc_iversion(inode);
> set_cached_acl(inode, type, acl);
> diff --git a/fs/stack.c b/fs/stack.c
> index c9830924eb12..efd0de85bace 100644
> --- a/fs/stack.c
> +++ b/fs/stack.c
> @@ -68,7 +68,7 @@ void fsstack_copy_attr_all(struct inode *dest, const struct inode *src)
> dest->i_rdev = src->i_rdev;
> dest->i_atime = src->i_atime;
> dest->i_mtime = src->i_mtime;
> - dest->i_ctime = src->i_ctime;
> + inode_ctime_set(dest, inode_ctime_peek(src));
> dest->i_blkbits = src->i_blkbits;
> dest->i_flags = src->i_flags;
> set_nlink(dest, src->i_nlink);
> diff --git a/fs/stat.c b/fs/stat.c
> index 7c238da22ef0..5d87e34d6dd5 100644
> --- a/fs/stat.c
> +++ b/fs/stat.c
> @@ -58,7 +58,7 @@ void generic_fillattr(struct mnt_idmap *idmap, struct inode *inode,
> stat->size = i_size_read(inode);
> stat->atime = inode->i_atime;
> stat->mtime = inode->i_mtime;
> - stat->ctime = inode->i_ctime;
> + stat->ctime = inode_ctime_peek(inode);
> stat->blksize = i_blocksize(inode);
> stat->blocks = inode->i_blocks;
> }
> diff --git a/include/linux/fs_stack.h b/include/linux/fs_stack.h
> index 54210a42c30d..1488a118fe91 100644
> --- a/include/linux/fs_stack.h
> +++ b/include/linux/fs_stack.h
> @@ -24,7 +24,7 @@ static inline void fsstack_copy_attr_times(struct inode *dest,
> {
> dest->i_atime = src->i_atime;
> dest->i_mtime = src->i_mtime;
> - dest->i_ctime = src->i_ctime;
> + inode_ctime_set(dest, inode_ctime_peek(src));
> }
>
> #endif /* _LINUX_FS_STACK_H */
> --
> 2.41.0
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH 27/79] exfat: switch to new ctime accessors
[not found] ` <20230621144735.55953-1-jlayton@kernel.org>
2023-06-21 14:45 ` [PATCH 10/79] affs: switch to new ctime accessors Jeff Layton
2023-06-21 14:45 ` [PATCH 12/79] fs: " Jeff Layton
@ 2023-06-21 14:45 ` Jeff Layton
2023-06-21 14:45 ` [PATCH 33/79] fuse: " Jeff Layton
` (7 subsequent siblings)
10 siblings, 0 replies; 24+ messages in thread
From: Jeff Layton @ 2023-06-21 14:45 UTC (permalink / raw)
To: Christian Brauner, Namjae Jeon, Sungjong Seo
Cc: Al Viro, Jan Kara, linux-fsdevel, linux-kernel
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@kernel.org>
---
fs/exfat/file.c | 4 ++--
fs/exfat/inode.c | 6 +++---
fs/exfat/namei.c | 29 ++++++++++++++---------------
fs/exfat/super.c | 4 ++--
4 files changed, 21 insertions(+), 22 deletions(-)
diff --git a/fs/exfat/file.c b/fs/exfat/file.c
index 3cbd270e0cba..853ba8ec4095 100644
--- a/fs/exfat/file.c
+++ b/fs/exfat/file.c
@@ -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_ctime_set_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_ctime_set_current(inode);
setattr_copy(&nop_mnt_idmap, inode, attr);
exfat_truncate_atime(&inode->i_atime);
diff --git a/fs/exfat/inode.c b/fs/exfat/inode.c
index 481dd338f2b8..b06b40b7c7b4 100644
--- a/fs/exfat/inode.c
+++ b/fs/exfat/inode.c
@@ -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_ctime_set_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_ctime_set_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_ctime_set(inode, info->mtime);
ei->i_crtime = info->crtime;
inode->i_atime = info->atime;
diff --git a/fs/exfat/namei.c b/fs/exfat/namei.c
index d9b46fa36bff..a8e6a84e6009 100644
--- a/fs/exfat/namei.c
+++ b/fs/exfat/namei.c
@@ -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_ctime_set_current(dir);
if (IS_DIRSYNC(dir))
exfat_sync_inode(dir);
else
@@ -582,8 +582,8 @@ 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_ctime_set_current(inode);
exfat_truncate_atime(&inode->i_atime);
/* timestamp is already written, so mark_inode_dirty() is unneeded. */
@@ -817,7 +817,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_ctime_set_current(dir);
exfat_truncate_atime(&dir->i_atime);
if (IS_DIRSYNC(dir))
exfat_sync_inode(dir);
@@ -825,7 +825,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_ctime_set_current(inode);
exfat_truncate_atime(&inode->i_atime);
exfat_unhash_inode(inode);
exfat_d_version_set(dentry, inode_query_iversion(dir));
@@ -852,7 +852,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_ctime_set_current(dir);
if (IS_DIRSYNC(dir))
exfat_sync_inode(dir);
else
@@ -866,8 +866,8 @@ 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_ctime_set_current(inode);
exfat_truncate_atime(&inode->i_atime);
/* timestamp is already written, so mark_inode_dirty() is unneeded. */
@@ -979,7 +979,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_ctime_set_current(dir);
exfat_truncate_atime(&dir->i_atime);
if (IS_DIRSYNC(dir))
exfat_sync_inode(dir);
@@ -988,7 +988,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_ctime_set_current(inode);
exfat_truncate_atime(&inode->i_atime);
exfat_unhash_inode(inode);
exfat_d_version_set(dentry, inode_query_iversion(dir));
@@ -1312,8 +1312,8 @@ static int exfat_rename(struct mnt_idmap *idmap,
goto unlock;
inode_inc_iversion(new_dir);
- new_dir->i_ctime = new_dir->i_mtime = new_dir->i_atime =
- EXFAT_I(new_dir)->i_crtime = current_time(new_dir);
+ new_dir->i_mtime = new_dir->i_atime = EXFAT_I(new_dir)->i_crtime =
+ inode_ctime_set_current(new_dir);
exfat_truncate_atime(&new_dir->i_atime);
if (IS_DIRSYNC(new_dir))
exfat_sync_inode(new_dir);
@@ -1336,7 +1336,7 @@ static int exfat_rename(struct mnt_idmap *idmap,
}
inode_inc_iversion(old_dir);
- old_dir->i_ctime = old_dir->i_mtime = current_time(old_dir);
+ old_dir->i_mtime = inode_ctime_set_current(old_dir);
if (IS_DIRSYNC(old_dir))
exfat_sync_inode(old_dir);
else
@@ -1354,8 +1354,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 = inode_ctime_set_current(new_inode);
}
unlock:
diff --git a/fs/exfat/super.c b/fs/exfat/super.c
index 8c32460e031e..f4f3ccedf1bc 100644
--- a/fs/exfat/super.c
+++ b/fs/exfat/super.c
@@ -379,8 +379,8 @@ 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_ctime_set_current(inode);
exfat_truncate_atime(&inode->i_atime);
return 0;
}
--
2.41.0
^ permalink raw reply related [flat|nested] 24+ messages in thread* [PATCH 33/79] fuse: switch to new ctime accessors
[not found] ` <20230621144735.55953-1-jlayton@kernel.org>
` (2 preceding siblings ...)
2023-06-21 14:45 ` [PATCH 27/79] exfat: " Jeff Layton
@ 2023-06-21 14:45 ` Jeff Layton
2023-06-21 14:45 ` [PATCH 35/79] hfs: " Jeff Layton
` (6 subsequent siblings)
10 siblings, 0 replies; 24+ messages in thread
From: Jeff Layton @ 2023-06-21 14:45 UTC (permalink / raw)
To: Christian Brauner, Miklos Szeredi
Cc: Al Viro, Jan Kara, linux-fsdevel, linux-kernel
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@kernel.org>
---
fs/fuse/control.c | 2 +-
fs/fuse/dir.c | 8 ++++----
fs/fuse/inode.c | 18 ++++++++++--------
3 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/fs/fuse/control.c b/fs/fuse/control.c
index 247ef4f76761..b5df89d0c95a 100644
--- a/fs/fuse/control.c
+++ b/fs/fuse/control.c
@@ -235,7 +235,7 @@ static struct dentry *fuse_ctl_add_dentry(struct dentry *parent,
inode->i_mode = mode;
inode->i_uid = fc->user_id;
inode->i_gid = fc->group_id;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
+ inode->i_atime = inode->i_mtime = inode_ctime_set_current(inode);
/* setting ->i_op to NULL is not allowed */
if (iop)
inode->i_op = iop;
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 5a4a7155cf1c..03fbb83b7127 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -933,7 +933,7 @@ void fuse_flush_time_update(struct inode *inode)
static void fuse_update_ctime_in_cache(struct inode *inode)
{
if (!IS_NOCMTIME(inode)) {
- inode->i_ctime = current_time(inode);
+ inode_ctime_set_current(inode);
mark_inode_dirty_sync(inode);
fuse_flush_time_update(inode);
}
@@ -1715,8 +1715,8 @@ int fuse_flush_times(struct inode *inode, struct fuse_file *ff)
inarg.mtimensec = inode->i_mtime.tv_nsec;
if (fm->fc->minor >= 23) {
inarg.valid |= FATTR_CTIME;
- inarg.ctime = inode->i_ctime.tv_sec;
- inarg.ctimensec = inode->i_ctime.tv_nsec;
+ inarg.ctime = inode_ctime_peek(inode).tv_sec;
+ inarg.ctimensec = inode_ctime_peek(inode).tv_nsec;
}
if (ff) {
inarg.valid |= FATTR_FH;
@@ -1857,7 +1857,7 @@ int fuse_do_setattr(struct dentry *dentry, struct iattr *attr,
if (attr->ia_valid & ATTR_MTIME)
inode->i_mtime = attr->ia_mtime;
if (attr->ia_valid & ATTR_CTIME)
- inode->i_ctime = attr->ia_ctime;
+ inode_ctime_set(inode, attr->ia_ctime);
/* FIXME: clear I_DIRTY_SYNC? */
}
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 660be31aaabc..54e06d3874e7 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -194,8 +194,8 @@ void fuse_change_attributes_common(struct inode *inode, struct fuse_attr *attr,
inode->i_mtime.tv_nsec = attr->mtimensec;
}
if (!(cache_mask & STATX_CTIME)) {
- inode->i_ctime.tv_sec = attr->ctime;
- inode->i_ctime.tv_nsec = attr->ctimensec;
+ inode_ctime_set_sec(inode, attr->ctime);
+ inode_ctime_set_nsec(inode, attr->ctimensec);
}
if (attr->blksize != 0)
@@ -259,8 +259,8 @@ void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr,
attr->mtimensec = inode->i_mtime.tv_nsec;
}
if (cache_mask & STATX_CTIME) {
- attr->ctime = inode->i_ctime.tv_sec;
- attr->ctimensec = inode->i_ctime.tv_nsec;
+ attr->ctime = inode_ctime_peek(inode).tv_sec;
+ attr->ctimensec = inode_ctime_peek(inode).tv_nsec;
}
if ((attr_version != 0 && fi->attr_version > attr_version) ||
@@ -318,8 +318,8 @@ static void fuse_init_inode(struct inode *inode, struct fuse_attr *attr,
inode->i_size = attr->size;
inode->i_mtime.tv_sec = attr->mtime;
inode->i_mtime.tv_nsec = attr->mtimensec;
- inode->i_ctime.tv_sec = attr->ctime;
- inode->i_ctime.tv_nsec = attr->ctimensec;
+ inode_ctime_set_sec(inode, attr->ctime);
+ inode_ctime_set_nsec(inode, attr->ctimensec);
if (S_ISREG(inode->i_mode)) {
fuse_init_common(inode);
fuse_init_file_inode(inode, attr->flags);
@@ -1398,16 +1398,18 @@ EXPORT_SYMBOL_GPL(fuse_dev_free);
static void fuse_fill_attr_from_inode(struct fuse_attr *attr,
const struct fuse_inode *fi)
{
+ struct timespec64 ctime = inode_ctime_peek(&fi->inode);
+
*attr = (struct fuse_attr){
.ino = fi->inode.i_ino,
.size = fi->inode.i_size,
.blocks = fi->inode.i_blocks,
.atime = fi->inode.i_atime.tv_sec,
.mtime = fi->inode.i_mtime.tv_sec,
- .ctime = fi->inode.i_ctime.tv_sec,
+ .ctime = ctime.tv_sec,
.atimensec = fi->inode.i_atime.tv_nsec,
.mtimensec = fi->inode.i_mtime.tv_nsec,
- .ctimensec = fi->inode.i_ctime.tv_nsec,
+ .ctimensec = ctime.tv_nsec,
.mode = fi->inode.i_mode,
.nlink = fi->inode.i_nlink,
.uid = fi->inode.i_uid.val,
--
2.41.0
^ permalink raw reply related [flat|nested] 24+ messages in thread* [PATCH 35/79] hfs: switch to new ctime accessors
[not found] ` <20230621144735.55953-1-jlayton@kernel.org>
` (3 preceding siblings ...)
2023-06-21 14:45 ` [PATCH 33/79] fuse: " Jeff Layton
@ 2023-06-21 14:45 ` Jeff Layton
2023-06-21 14:45 ` [PATCH 36/79] hfsplus: " Jeff Layton
` (5 subsequent siblings)
10 siblings, 0 replies; 24+ messages in thread
From: Jeff Layton @ 2023-06-21 14:45 UTC (permalink / raw)
To: Christian Brauner; +Cc: Al Viro, Jan Kara, linux-fsdevel, linux-kernel
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@kernel.org>
---
fs/hfs/catalog.c | 8 ++++----
fs/hfs/dir.c | 2 +-
fs/hfs/inode.c | 13 ++++++-------
fs/hfs/sysdep.c | 2 +-
4 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/fs/hfs/catalog.c b/fs/hfs/catalog.c
index d365bf0b8c77..6fd2ae856178 100644
--- a/fs/hfs/catalog.c
+++ b/fs/hfs/catalog.c
@@ -133,7 +133,7 @@ int hfs_cat_create(u32 cnid, struct inode *dir, const struct qstr *str, struct i
goto err1;
dir->i_size++;
- dir->i_mtime = dir->i_ctime = current_time(dir);
+ dir->i_mtime = inode_ctime_set_current(dir);
mark_inode_dirty(dir);
hfs_find_exit(&fd);
return 0;
@@ -269,7 +269,7 @@ int hfs_cat_delete(u32 cnid, struct inode *dir, const struct qstr *str)
}
dir->i_size--;
- dir->i_mtime = dir->i_ctime = current_time(dir);
+ dir->i_mtime = inode_ctime_set_current(dir);
mark_inode_dirty(dir);
res = 0;
out:
@@ -337,7 +337,7 @@ int hfs_cat_move(u32 cnid, struct inode *src_dir, const struct qstr *src_name,
if (err)
goto out;
dst_dir->i_size++;
- dst_dir->i_mtime = dst_dir->i_ctime = current_time(dst_dir);
+ dst_dir->i_mtime = inode_ctime_set_current(dst_dir);
mark_inode_dirty(dst_dir);
/* finally remove the old entry */
@@ -349,7 +349,7 @@ int hfs_cat_move(u32 cnid, struct inode *src_dir, const struct qstr *src_name,
if (err)
goto out;
src_dir->i_size--;
- src_dir->i_mtime = src_dir->i_ctime = current_time(src_dir);
+ src_dir->i_mtime = inode_ctime_set_current(src_dir);
mark_inode_dirty(src_dir);
type = entry.type;
diff --git a/fs/hfs/dir.c b/fs/hfs/dir.c
index 3e1e3dcf0b48..bb9e651c1008 100644
--- a/fs/hfs/dir.c
+++ b/fs/hfs/dir.c
@@ -263,7 +263,7 @@ static int hfs_remove(struct inode *dir, struct dentry *dentry)
if (res)
return res;
clear_nlink(inode);
- inode->i_ctime = current_time(inode);
+ inode_ctime_set_current(inode);
hfs_delete_inode(inode);
mark_inode_dirty(inode);
return 0;
diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c
index 441d7fc952e3..d8008d926a19 100644
--- a/fs/hfs/inode.c
+++ b/fs/hfs/inode.c
@@ -200,7 +200,7 @@ struct inode *hfs_new_inode(struct inode *dir, const struct qstr *name, umode_t
inode->i_uid = current_fsuid();
inode->i_gid = current_fsgid();
set_nlink(inode, 1);
- inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
+ inode->i_mtime = inode->i_atime = inode_ctime_set_current(inode);
HFS_I(inode)->flags = 0;
HFS_I(inode)->rsrc_inode = NULL;
HFS_I(inode)->fs_blocks = 0;
@@ -355,8 +355,8 @@ static int hfs_read_inode(struct inode *inode, void *data)
inode->i_mode |= S_IWUGO;
inode->i_mode &= ~hsb->s_file_umask;
inode->i_mode |= S_IFREG;
- inode->i_ctime = inode->i_atime = inode->i_mtime =
- hfs_m_to_utime(rec->file.MdDat);
+ inode->i_atime = inode->i_mtime = hfs_m_to_utime(rec->file.MdDat);
+ inode_ctime_set(inode, inode->i_mtime);
inode->i_op = &hfs_file_inode_operations;
inode->i_fop = &hfs_file_operations;
inode->i_mapping->a_ops = &hfs_aops;
@@ -366,8 +366,8 @@ static int hfs_read_inode(struct inode *inode, void *data)
inode->i_size = be16_to_cpu(rec->dir.Val) + 2;
HFS_I(inode)->fs_blocks = 0;
inode->i_mode = S_IFDIR | (S_IRWXUGO & ~hsb->s_dir_umask);
- inode->i_ctime = inode->i_atime = inode->i_mtime =
- hfs_m_to_utime(rec->dir.MdDat);
+ inode->i_atime = inode->i_mtime = hfs_m_to_utime(rec->dir.MdDat);
+ inode_ctime_set(inode, inode->i_mtime);
inode->i_op = &hfs_dir_inode_operations;
inode->i_fop = &hfs_dir_operations;
break;
@@ -654,8 +654,7 @@ int hfs_inode_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
truncate_setsize(inode, attr->ia_size);
hfs_file_truncate(inode);
- inode->i_atime = inode->i_mtime = inode->i_ctime =
- current_time(inode);
+ inode->i_atime = inode->i_mtime = inode_ctime_set_current(inode);
}
setattr_copy(&nop_mnt_idmap, inode, attr);
diff --git a/fs/hfs/sysdep.c b/fs/hfs/sysdep.c
index 2875961fdc10..e2949390fadc 100644
--- a/fs/hfs/sysdep.c
+++ b/fs/hfs/sysdep.c
@@ -28,7 +28,7 @@ static int hfs_revalidate_dentry(struct dentry *dentry, unsigned int flags)
/* fix up inode on a timezone change */
diff = sys_tz.tz_minuteswest * 60 - HFS_I(inode)->tz_secondswest;
if (diff) {
- inode->i_ctime.tv_sec += diff;
+ inode_ctime_set_sec(inode, inode_ctime_peek(inode).tv_sec + diff);
inode->i_atime.tv_sec += diff;
inode->i_mtime.tv_sec += diff;
HFS_I(inode)->tz_secondswest += diff;
--
2.41.0
^ permalink raw reply related [flat|nested] 24+ messages in thread* [PATCH 36/79] hfsplus: switch to new ctime accessors
[not found] ` <20230621144735.55953-1-jlayton@kernel.org>
` (4 preceding siblings ...)
2023-06-21 14:45 ` [PATCH 35/79] hfs: " Jeff Layton
@ 2023-06-21 14:45 ` Jeff Layton
2023-06-21 14:45 ` [PATCH 40/79] isofs: " Jeff Layton
` (4 subsequent siblings)
10 siblings, 0 replies; 24+ messages in thread
From: Jeff Layton @ 2023-06-21 14:45 UTC (permalink / raw)
To: Christian Brauner; +Cc: Al Viro, Jan Kara, linux-fsdevel, linux-kernel
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@kernel.org>
---
fs/hfsplus/catalog.c | 8 ++++----
fs/hfsplus/dir.c | 6 +++---
fs/hfsplus/inode.c | 14 +++++++-------
3 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/fs/hfsplus/catalog.c b/fs/hfsplus/catalog.c
index 35472cba750e..0e1938729669 100644
--- a/fs/hfsplus/catalog.c
+++ b/fs/hfsplus/catalog.c
@@ -312,7 +312,7 @@ int hfsplus_create_cat(u32 cnid, struct inode *dir,
dir->i_size++;
if (S_ISDIR(inode->i_mode))
hfsplus_subfolders_inc(dir);
- dir->i_mtime = dir->i_ctime = current_time(dir);
+ dir->i_mtime = inode_ctime_set_current(dir);
hfsplus_mark_inode_dirty(dir, HFSPLUS_I_CAT_DIRTY);
hfs_find_exit(&fd);
@@ -417,7 +417,7 @@ int hfsplus_delete_cat(u32 cnid, struct inode *dir, const struct qstr *str)
dir->i_size--;
if (type == HFSPLUS_FOLDER)
hfsplus_subfolders_dec(dir);
- dir->i_mtime = dir->i_ctime = current_time(dir);
+ dir->i_mtime = inode_ctime_set_current(dir);
hfsplus_mark_inode_dirty(dir, HFSPLUS_I_CAT_DIRTY);
if (type == HFSPLUS_FILE || type == HFSPLUS_FOLDER) {
@@ -494,7 +494,7 @@ int hfsplus_rename_cat(u32 cnid,
dst_dir->i_size++;
if (type == HFSPLUS_FOLDER)
hfsplus_subfolders_inc(dst_dir);
- dst_dir->i_mtime = dst_dir->i_ctime = current_time(dst_dir);
+ dst_dir->i_mtime = inode_ctime_set_current(dst_dir);
/* finally remove the old entry */
err = hfsplus_cat_build_key(sb, src_fd.search_key,
@@ -511,7 +511,7 @@ int hfsplus_rename_cat(u32 cnid,
src_dir->i_size--;
if (type == HFSPLUS_FOLDER)
hfsplus_subfolders_dec(src_dir);
- src_dir->i_mtime = src_dir->i_ctime = current_time(src_dir);
+ src_dir->i_mtime = inode_ctime_set_current(src_dir);
/* remove old thread entry */
hfsplus_cat_build_key_with_cnid(sb, src_fd.search_key, cnid);
diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c
index 56fb5f1312e7..e7b6de12ecef 100644
--- a/fs/hfsplus/dir.c
+++ b/fs/hfsplus/dir.c
@@ -346,7 +346,7 @@ static int hfsplus_link(struct dentry *src_dentry, struct inode *dst_dir,
inc_nlink(inode);
hfsplus_instantiate(dst_dentry, inode, cnid);
ihold(inode);
- inode->i_ctime = current_time(inode);
+ inode_ctime_set_current(inode);
mark_inode_dirty(inode);
sbi->file_count++;
hfsplus_mark_mdb_dirty(dst_dir->i_sb);
@@ -405,7 +405,7 @@ static int hfsplus_unlink(struct inode *dir, struct dentry *dentry)
hfsplus_delete_inode(inode);
} else
sbi->file_count--;
- inode->i_ctime = current_time(inode);
+ inode_ctime_set_current(inode);
mark_inode_dirty(inode);
out:
mutex_unlock(&sbi->vh_mutex);
@@ -426,7 +426,7 @@ static int hfsplus_rmdir(struct inode *dir, struct dentry *dentry)
if (res)
goto out;
clear_nlink(inode);
- inode->i_ctime = current_time(inode);
+ inode_ctime_set_current(inode);
hfsplus_delete_inode(inode);
mark_inode_dirty(inode);
out:
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c
index 7d1a675e037d..b9c02df839c8 100644
--- a/fs/hfsplus/inode.c
+++ b/fs/hfsplus/inode.c
@@ -267,7 +267,7 @@ static int hfsplus_setattr(struct mnt_idmap *idmap,
}
truncate_setsize(inode, attr->ia_size);
hfsplus_file_truncate(inode);
- inode->i_mtime = inode->i_ctime = current_time(inode);
+ inode->i_mtime = inode_ctime_set_current(inode);
}
setattr_copy(&nop_mnt_idmap, inode, attr);
@@ -392,7 +392,7 @@ struct inode *hfsplus_new_inode(struct super_block *sb, struct inode *dir,
inode->i_ino = sbi->next_cnid++;
inode_init_owner(&nop_mnt_idmap, inode, dir, mode);
set_nlink(inode, 1);
- inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
+ inode->i_mtime = inode->i_atime = inode_ctime_set_current(inode);
hip = HFSPLUS_I(inode);
INIT_LIST_HEAD(&hip->open_dir_list);
@@ -523,7 +523,7 @@ int hfsplus_cat_read_inode(struct inode *inode, struct hfs_find_data *fd)
inode->i_size = 2 + be32_to_cpu(folder->valence);
inode->i_atime = hfsp_mt2ut(folder->access_date);
inode->i_mtime = hfsp_mt2ut(folder->content_mod_date);
- inode->i_ctime = hfsp_mt2ut(folder->attribute_mod_date);
+ inode_ctime_set(inode, hfsp_mt2ut(folder->attribute_mod_date));
HFSPLUS_I(inode)->create_date = folder->create_date;
HFSPLUS_I(inode)->fs_blocks = 0;
if (folder->flags & cpu_to_be16(HFSPLUS_HAS_FOLDER_COUNT)) {
@@ -564,7 +564,7 @@ int hfsplus_cat_read_inode(struct inode *inode, struct hfs_find_data *fd)
}
inode->i_atime = hfsp_mt2ut(file->access_date);
inode->i_mtime = hfsp_mt2ut(file->content_mod_date);
- inode->i_ctime = hfsp_mt2ut(file->attribute_mod_date);
+ inode_ctime_set(inode, hfsp_mt2ut(file->attribute_mod_date));
HFSPLUS_I(inode)->create_date = file->create_date;
} else {
pr_err("bad catalog entry used to create inode\n");
@@ -609,7 +609,7 @@ int hfsplus_cat_write_inode(struct inode *inode)
hfsplus_cat_set_perms(inode, &folder->permissions);
folder->access_date = hfsp_ut2mt(inode->i_atime);
folder->content_mod_date = hfsp_ut2mt(inode->i_mtime);
- folder->attribute_mod_date = hfsp_ut2mt(inode->i_ctime);
+ folder->attribute_mod_date = hfsp_ut2mt(inode_ctime_peek(inode));
folder->valence = cpu_to_be32(inode->i_size - 2);
if (folder->flags & cpu_to_be16(HFSPLUS_HAS_FOLDER_COUNT)) {
folder->subfolders =
@@ -644,7 +644,7 @@ int hfsplus_cat_write_inode(struct inode *inode)
file->flags &= cpu_to_be16(~HFSPLUS_FILE_LOCKED);
file->access_date = hfsp_ut2mt(inode->i_atime);
file->content_mod_date = hfsp_ut2mt(inode->i_mtime);
- file->attribute_mod_date = hfsp_ut2mt(inode->i_ctime);
+ file->attribute_mod_date = hfsp_ut2mt(inode_ctime_peek(inode));
hfs_bnode_write(fd.bnode, &entry, fd.entryoffset,
sizeof(struct hfsplus_cat_file));
}
@@ -700,7 +700,7 @@ int hfsplus_fileattr_set(struct mnt_idmap *idmap,
else
hip->userflags &= ~HFSPLUS_FLG_NODUMP;
- inode->i_ctime = current_time(inode);
+ inode_ctime_set_current(inode);
mark_inode_dirty(inode);
return 0;
--
2.41.0
^ permalink raw reply related [flat|nested] 24+ messages in thread* [PATCH 40/79] isofs: switch to new ctime accessors
[not found] ` <20230621144735.55953-1-jlayton@kernel.org>
` (5 preceding siblings ...)
2023-06-21 14:45 ` [PATCH 36/79] hfsplus: " Jeff Layton
@ 2023-06-21 14:45 ` Jeff Layton
2023-06-21 14:46 ` [PATCH 55/79] proc: " Jeff Layton
` (3 subsequent siblings)
10 siblings, 0 replies; 24+ messages in thread
From: Jeff Layton @ 2023-06-21 14:45 UTC (permalink / raw)
To: Christian Brauner, Jan Kara; +Cc: Al Viro, linux-fsdevel, linux-kernel
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@kernel.org>
---
fs/isofs/inode.c | 4 ++--
fs/isofs/rock.c | 16 +++++++---------
2 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index df9d70588b60..035fa0271d6e 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -1425,10 +1425,10 @@ static int isofs_read_inode(struct inode *inode, int relocated)
inode->i_mtime.tv_sec =
inode->i_atime.tv_sec =
- inode->i_ctime.tv_sec = iso_date(de->date, high_sierra);
+ inode_ctime_set_sec(inode, iso_date(de->date, high_sierra));
inode->i_mtime.tv_nsec =
inode->i_atime.tv_nsec =
- inode->i_ctime.tv_nsec = 0;
+ inode_ctime_set_nsec(inode, 0);
ei->i_first_extent = (isonum_733(de->extent) +
isonum_711(de->ext_attr_length));
diff --git a/fs/isofs/rock.c b/fs/isofs/rock.c
index 48f58c6c9e69..6b7f2a62124d 100644
--- a/fs/isofs/rock.c
+++ b/fs/isofs/rock.c
@@ -421,10 +421,9 @@ parse_rock_ridge_inode_internal(struct iso_directory_record *de,
/* Rock ridge never appears on a High Sierra disk */
cnt = 0;
if (rr->u.TF.flags & TF_CREATE) {
- inode->i_ctime.tv_sec =
- iso_date(rr->u.TF.times[cnt++].time,
- 0);
- inode->i_ctime.tv_nsec = 0;
+ inode_ctime_set_sec(inode,
+ iso_date(rr->u.TF.times[cnt++].time, 0));
+ inode_ctime_set_nsec(inode, 0);
}
if (rr->u.TF.flags & TF_MODIFY) {
inode->i_mtime.tv_sec =
@@ -439,10 +438,9 @@ parse_rock_ridge_inode_internal(struct iso_directory_record *de,
inode->i_atime.tv_nsec = 0;
}
if (rr->u.TF.flags & TF_ATTRIBUTES) {
- inode->i_ctime.tv_sec =
- iso_date(rr->u.TF.times[cnt++].time,
- 0);
- inode->i_ctime.tv_nsec = 0;
+ inode_ctime_set_sec(inode,
+ iso_date(rr->u.TF.times[cnt++].time, 0));
+ inode_ctime_set_nsec(inode, 0);
}
break;
case SIG('S', 'L'):
@@ -534,7 +532,7 @@ parse_rock_ridge_inode_internal(struct iso_directory_record *de,
inode->i_size = reloc->i_size;
inode->i_blocks = reloc->i_blocks;
inode->i_atime = reloc->i_atime;
- inode->i_ctime = reloc->i_ctime;
+ inode_ctime_set(inode, inode_ctime_peek(reloc));
inode->i_mtime = reloc->i_mtime;
iput(reloc);
break;
--
2.41.0
^ permalink raw reply related [flat|nested] 24+ messages in thread* [PATCH 55/79] proc: switch to new ctime accessors
[not found] ` <20230621144735.55953-1-jlayton@kernel.org>
` (6 preceding siblings ...)
2023-06-21 14:45 ` [PATCH 40/79] isofs: " Jeff Layton
@ 2023-06-21 14:46 ` Jeff Layton
2023-06-30 22:13 ` Luis Chamberlain
2023-06-21 14:46 ` [PATCH 69/79] vboxsf: " Jeff Layton
` (2 subsequent siblings)
10 siblings, 1 reply; 24+ messages in thread
From: Jeff Layton @ 2023-06-21 14:46 UTC (permalink / raw)
To: Christian Brauner, Luis Chamberlain, Kees Cook, Iurii Zaikin
Cc: Al Viro, Jan Kara, linux-kernel, linux-fsdevel
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@kernel.org>
---
fs/proc/base.c | 2 +-
fs/proc/inode.c | 2 +-
fs/proc/proc_sysctl.c | 2 +-
fs/proc/self.c | 2 +-
fs/proc/thread_self.c | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 05452c3b9872..354f7f9ad05b 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -1902,7 +1902,7 @@ struct inode *proc_pid_make_inode(struct super_block *sb,
ei = PROC_I(inode);
inode->i_mode = mode;
inode->i_ino = get_next_ino();
- inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
+ inode->i_mtime = inode->i_atime = inode_ctime_set_current(inode);
inode->i_op = &proc_def_inode_operations;
/*
diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index 67b09a1d9433..61f4fc0a6261 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -660,7 +660,7 @@ struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de)
inode->i_private = de->data;
inode->i_ino = de->low_ino;
- inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
+ inode->i_mtime = inode->i_atime = inode_ctime_set_current(inode);
PROC_I(inode)->pde = de;
if (is_empty_pde(de)) {
make_empty_dir_inode(inode);
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index 4e5488975415..abb7e524b28b 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -463,7 +463,7 @@ static struct inode *proc_sys_make_inode(struct super_block *sb,
head->count++;
spin_unlock(&sysctl_lock);
- inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
+ inode->i_mtime = inode->i_atime = inode_ctime_set_current(inode);
inode->i_mode = table->mode;
if (!S_ISDIR(table->mode)) {
inode->i_mode |= S_IFREG;
diff --git a/fs/proc/self.c b/fs/proc/self.c
index 72cd69bcaf4a..bb5dbdd30627 100644
--- a/fs/proc/self.c
+++ b/fs/proc/self.c
@@ -46,7 +46,7 @@ int proc_setup_self(struct super_block *s)
struct inode *inode = new_inode(s);
if (inode) {
inode->i_ino = self_inum;
- inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
+ inode->i_mtime = inode->i_atime = inode_ctime_set_current(inode);
inode->i_mode = S_IFLNK | S_IRWXUGO;
inode->i_uid = GLOBAL_ROOT_UID;
inode->i_gid = GLOBAL_ROOT_GID;
diff --git a/fs/proc/thread_self.c b/fs/proc/thread_self.c
index a553273fbd41..373680bd0635 100644
--- a/fs/proc/thread_self.c
+++ b/fs/proc/thread_self.c
@@ -46,7 +46,7 @@ int proc_setup_thread_self(struct super_block *s)
struct inode *inode = new_inode(s);
if (inode) {
inode->i_ino = thread_self_inum;
- inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
+ inode->i_mtime = inode->i_atime = inode_ctime_set_current(inode);
inode->i_mode = S_IFLNK | S_IRWXUGO;
inode->i_uid = GLOBAL_ROOT_UID;
inode->i_gid = GLOBAL_ROOT_GID;
--
2.41.0
^ permalink raw reply related [flat|nested] 24+ messages in thread* Re: [PATCH 55/79] proc: switch to new ctime accessors
2023-06-21 14:46 ` [PATCH 55/79] proc: " Jeff Layton
@ 2023-06-30 22:13 ` Luis Chamberlain
0 siblings, 0 replies; 24+ messages in thread
From: Luis Chamberlain @ 2023-06-30 22:13 UTC (permalink / raw)
To: Jeff Layton
Cc: Christian Brauner, Kees Cook, Iurii Zaikin, Al Viro, Jan Kara,
linux-kernel, linux-fsdevel
On Wed, Jun 21, 2023 at 10:46:08AM -0400, Jeff Layton 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@kernel.org>
Acked-by: Luis Chamberlain <mcgrof@kernel.org>
Luis
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH 69/79] vboxsf: switch to new ctime accessors
[not found] ` <20230621144735.55953-1-jlayton@kernel.org>
` (7 preceding siblings ...)
2023-06-21 14:46 ` [PATCH 55/79] proc: " Jeff Layton
@ 2023-06-21 14:46 ` Jeff Layton
2023-06-21 14:46 ` [PATCH 71/79] zonefs: " Jeff Layton
[not found] ` <20230621144735.55953-14-jlayton@kernel.org>
10 siblings, 0 replies; 24+ messages in thread
From: Jeff Layton @ 2023-06-21 14:46 UTC (permalink / raw)
To: Christian Brauner, Hans de Goede
Cc: Al Viro, Jan Kara, linux-fsdevel, linux-kernel
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@kernel.org>
---
fs/vboxsf/utils.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/vboxsf/utils.c b/fs/vboxsf/utils.c
index dd0ae1188e87..a76dc1ec10f8 100644
--- a/fs/vboxsf/utils.c
+++ b/fs/vboxsf/utils.c
@@ -128,8 +128,8 @@ int vboxsf_init_inode(struct vboxsf_sbi *sbi, struct inode *inode,
inode->i_atime = ns_to_timespec64(
info->access_time.ns_relative_to_unix_epoch);
- inode->i_ctime = ns_to_timespec64(
- info->change_time.ns_relative_to_unix_epoch);
+ inode_ctime_set(inode,
+ ns_to_timespec64(info->change_time.ns_relative_to_unix_epoch));
inode->i_mtime = ns_to_timespec64(
info->modification_time.ns_relative_to_unix_epoch);
return 0;
--
2.41.0
^ permalink raw reply related [flat|nested] 24+ messages in thread* [PATCH 71/79] zonefs: switch to new ctime accessors
[not found] ` <20230621144735.55953-1-jlayton@kernel.org>
` (8 preceding siblings ...)
2023-06-21 14:46 ` [PATCH 69/79] vboxsf: " Jeff Layton
@ 2023-06-21 14:46 ` Jeff Layton
2023-06-22 0:48 ` Damien Le Moal
[not found] ` <20230621144735.55953-14-jlayton@kernel.org>
10 siblings, 1 reply; 24+ messages in thread
From: Jeff Layton @ 2023-06-21 14:46 UTC (permalink / raw)
To: Christian Brauner, Damien Le Moal, Naohiro Aota,
Johannes Thumshirn
Cc: Al Viro, Jan Kara, linux-fsdevel, linux-kernel
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@kernel.org>
---
fs/zonefs/super.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c
index bbe44a26a8e5..75be0e039ccf 100644
--- a/fs/zonefs/super.c
+++ b/fs/zonefs/super.c
@@ -658,7 +658,8 @@ static struct inode *zonefs_get_file_inode(struct inode *dir,
inode->i_ino = ino;
inode->i_mode = z->z_mode;
- inode->i_ctime = inode->i_mtime = inode->i_atime = dir->i_ctime;
+ inode->i_mtime = inode->i_atime = inode_ctime_peek(dir);
+ inode_ctime_set(inode, inode->i_mtime);
inode->i_uid = z->z_uid;
inode->i_gid = z->z_gid;
inode->i_size = z->z_wpoffset;
@@ -694,7 +695,8 @@ static struct inode *zonefs_get_zgroup_inode(struct super_block *sb,
inode->i_ino = ino;
inode_init_owner(&nop_mnt_idmap, inode, root, S_IFDIR | 0555);
inode->i_size = sbi->s_zgroup[ztype].g_nr_zones;
- inode->i_ctime = inode->i_mtime = inode->i_atime = root->i_ctime;
+ inode->i_mtime = inode->i_atime = inode_ctime_peek(root);
+ inode_ctime_set(inode, inode->i_mtime);
inode->i_private = &sbi->s_zgroup[ztype];
set_nlink(inode, 2);
@@ -1317,7 +1319,7 @@ static int zonefs_fill_super(struct super_block *sb, void *data, int silent)
inode->i_ino = bdev_nr_zones(sb->s_bdev);
inode->i_mode = S_IFDIR | 0555;
- inode->i_ctime = inode->i_mtime = inode->i_atime = current_time(inode);
+ inode->i_atime = inode->i_mtime = inode_ctime_set_current(inode);
inode->i_op = &zonefs_dir_inode_operations;
inode->i_fop = &zonefs_dir_operations;
inode->i_size = 2;
--
2.41.0
^ permalink raw reply related [flat|nested] 24+ messages in thread* Re: [PATCH 71/79] zonefs: switch to new ctime accessors
2023-06-21 14:46 ` [PATCH 71/79] zonefs: " Jeff Layton
@ 2023-06-22 0:48 ` Damien Le Moal
0 siblings, 0 replies; 24+ messages in thread
From: Damien Le Moal @ 2023-06-22 0:48 UTC (permalink / raw)
To: Jeff Layton, Christian Brauner, Naohiro Aota, Johannes Thumshirn
Cc: Al Viro, Jan Kara, linux-fsdevel, linux-kernel
On 6/21/23 23:46, Jeff Layton 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@kernel.org>
Modulo the proposed renaming for inode_ctime_peek(), looks good.
Acked-by: Damien Le Moal <dlemoal@kernel.org>
> ---
> fs/zonefs/super.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c
> index bbe44a26a8e5..75be0e039ccf 100644
> --- a/fs/zonefs/super.c
> +++ b/fs/zonefs/super.c
> @@ -658,7 +658,8 @@ static struct inode *zonefs_get_file_inode(struct inode *dir,
>
> inode->i_ino = ino;
> inode->i_mode = z->z_mode;
> - inode->i_ctime = inode->i_mtime = inode->i_atime = dir->i_ctime;
> + inode->i_mtime = inode->i_atime = inode_ctime_peek(dir);
> + inode_ctime_set(inode, inode->i_mtime);
> inode->i_uid = z->z_uid;
> inode->i_gid = z->z_gid;
> inode->i_size = z->z_wpoffset;
> @@ -694,7 +695,8 @@ static struct inode *zonefs_get_zgroup_inode(struct super_block *sb,
> inode->i_ino = ino;
> inode_init_owner(&nop_mnt_idmap, inode, root, S_IFDIR | 0555);
> inode->i_size = sbi->s_zgroup[ztype].g_nr_zones;
> - inode->i_ctime = inode->i_mtime = inode->i_atime = root->i_ctime;
> + inode->i_mtime = inode->i_atime = inode_ctime_peek(root);
> + inode_ctime_set(inode, inode->i_mtime);
> inode->i_private = &sbi->s_zgroup[ztype];
> set_nlink(inode, 2);
>
> @@ -1317,7 +1319,7 @@ static int zonefs_fill_super(struct super_block *sb, void *data, int silent)
>
> inode->i_ino = bdev_nr_zones(sb->s_bdev);
> inode->i_mode = S_IFDIR | 0555;
> - inode->i_ctime = inode->i_mtime = inode->i_atime = current_time(inode);
> + inode->i_atime = inode->i_mtime = inode_ctime_set_current(inode);
> inode->i_op = &zonefs_dir_inode_operations;
> inode->i_fop = &zonefs_dir_operations;
> inode->i_size = 2;
--
Damien Le Moal
Western Digital Research
^ permalink raw reply [flat|nested] 24+ messages in thread
[parent not found: <20230621144735.55953-14-jlayton@kernel.org>]