linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [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

* [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

* [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

* [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 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 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

* 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

* Re: [PATCH 01/79] fs: add ctime accessors infrastructure
       [not found]   ` <99b3c749-23d9-6f09-fb75-6a84f3d1b066@kernel.org>
@ 2023-06-22 10:14     ` Jeff Layton
  0 siblings, 0 replies; 24+ messages in thread
From: Jeff Layton @ 2023-06-22 10:14 UTC (permalink / raw)
  To: Damien Le Moal, Jeremy Kerr, Arnd Bergmann, Michael Ellerman,
	Nicholas Piggin, Christophe Leroy, Heiko Carstens, Vasily Gorbik,
	Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
	Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
	Martijn Coenen, Joel Fernandes, Christian Brauner, Carlos Llamas,
	Suren Baghdasaryan, Dennis Dalessandro, Jason Gunthorpe,
	Leon Romanovsky, Brad Warrum, Ritu Agarwal, Eric Van Hensbergen,
	Latchesar Ionkov, Dominique Martinet, Christian Schoenebeck,
	David Sterba, David Howells, Marc Dionne, Alexander Viro,
	Ian Kent, Luis de Bethencourt, Salah Triki, Tigran A. Aivazian,
	Eric Biederman, Kees Cook, Chris Mason, Josef Bacik, Xiubo Li,
	Ilya Dryomov, Jan Harkes, coda, Joel Becker, Christoph Hellwig,
	Nicolas Pitre, Rafael J. Wysocki, Tyler Hicks, Ard Biesheuvel,
	Gao Xiang, Chao Yu, Yue Hu, Jeffle Xu, Namjae Jeon, Sungjong Seo,
	Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
	OGAWA Hirofumi, Miklos Szeredi, Bob Peterson, Andreas Gruenbacher,
	Richard Weinberger, Anton Ivanov, Johannes Berg, Mikulas Patocka,
	Mike Kravetz, Muchun Song, David Woodhouse, Dave Kleikamp,
	Tejun Heo, Trond Myklebust, Anna Schumaker, Chuck Lever,
	Ryusuke Konishi, Anton Altaparmakov, Konstantin Komarov,
	Mark Fasheh, Joseph Qi, Bob Copeland, Mike Marshall,
	Martin Brandenburg, Luis Chamberlain, Iurii Zaikin, Tony Luck,
	Guilherme G. Piccoli, Anders Larsen, Steve French,
	Paulo Alcantara, Ronnie Sahlberg, Shyam Prasad N, Tom Talpey,
	Sergey Senozhatsky, Phillip Lougher, Steven Rostedt,
	Masami Hiramatsu, Evgeniy Dushistov, Hans de Goede,
	Darrick J. Wong, Naohiro Aota, Johannes Thumshirn,
	Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa, Hugh Dickins,
	Andrew Morton, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, John Johansen, Paul Moore, James Morris,
	Serge E. Hallyn, Stephen Smalley, Eric Paris, Juergen Gross,
	Ruihan Li, Laurent Pinchart, Wolfram Sang, Udipto Goswami,
	Linyu Yuan, John Keeping, Andrzej Pietrasiewicz, Dan Carpenter,
	Yuta Hayama, Jozef Martiniak, Jens Axboe, Alan Stern,
	Sandeep Dhavale, Dave Chinner, Johannes Weiner, ZhangPeng,
	Viacheslav Dubeyko, Tetsuo Handa, Aditya Garg, Erez Zadok,
	Yifei Liu, Yu Zhe, Matthew Wilcox (Oracle), Oleg Kanatov,
	Dr. David Alan Gilbert, Jiangshan Yi, xu xin, Stefan Roesch,
	Zhihao Cheng, Liam R. Howlett, Alexey Dobriyan, Minghao Chi,
	Seth Forshee, Zeng Jingxiang, Bart Van Assche, Mimi Zohar,
	Roberto Sassu, Zhang Yi, Tom Rix, Fabio M. De Francesco,
	Chen Zhongjin, Zhengchao Shao, Rik van Riel, Jingyu Wang,
	Hangyu Hua, linuxppc-dev, linux-kernel, linux-s390, linux-rdma,
	linux-usb, v9fs, linux-fsdevel, linux-afs, autofs, linux-mm,
	linux-btrfs, ceph-devel, codalist, ecryptfs, linux-efi,
	linux-erofs, linux-ext4, linux-f2fs-devel, cluster-devel,
	linux-um, linux-mtd, jfs-discussion, linux-nfs, linux-nilfs,
	linux-ntfs-dev, ntfs3, ocfs2-devel, linux-karma-devel, devel,
	linux-unionfs, linux-hardening, reiserfs-devel, linux-cifs,
	samba-technical, linux-trace-kernel, linux-xfs, bpf, netdev,
	apparmor, linux-security-module, selinux

On Thu, 2023-06-22 at 09:46 +0900, Damien Le Moal wrote:
> On 6/21/23 23:45, Jeff Layton wrote:
> > struct timespec64 has unused bits in the tv_nsec field that can be used
> > for other purposes. In future patches, we're going to change how the
> > inode->i_ctime is accessed in certain inodes in order to make use of
> > them. In order to do that safely though, we'll need to eradicate raw
> > accesses of the inode->i_ctime field from the kernel.
> > 
> > Add new accessor functions for the ctime that we can use to replace them.
> > 
> > Signed-off-by: Jeff Layton <jlayton@kernel.org>
> 
> [...]
> 
> > +/**
> > + * inode_ctime_peek - fetch the current ctime from the inode
> > + * @inode: inode from which to fetch ctime
> > + *
> > + * Grab the current ctime from the inode and return it.
> > + */
> > +static inline struct timespec64 inode_ctime_peek(const struct inode *inode)
> 
> To be consistent with inode_ctime_set(), why not call this one inode_ctime_get()

In later patches fetching the ctime for presentation may have side
effects on certain filesystems. Using "peek" here is a hint that we want
to avoid those side effects in these calls.

> ? Also, inode_set_ctime() & inode_get_ctime() may be a little more natural. But
> no strong opinion about that though.
> 

I like the consistency of the inode_ctime_* prefix. It makes it simpler
to find these calls when grepping, etc.

That said, my opinions on naming are pretty loosely-held, so if the
consensus is that the names should as you suggest, I'll go along with
it.
-- 
Jeff Layton <jlayton@kernel.org>

^ 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

* Re: [PATCH 00/79] fs: new accessors for inode->i_ctime
       [not found]   ` <2a5a069572b46b59dd16fe8d54e549a9b5bbb6eb.camel@kernel.org>
@ 2023-06-23 12:41     ` Christian Brauner
  0 siblings, 0 replies; 24+ messages in thread
From: Christian Brauner @ 2023-06-23 12:41 UTC (permalink / raw)
  To: Jeff Layton
  Cc: Steven Rostedt, Jeremy Kerr, Arnd Bergmann, Michael Ellerman,
	Nicholas Piggin, Christophe Leroy, Heiko Carstens, Vasily Gorbik,
	Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
	Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
	Martijn Coenen, Joel Fernandes, Carlos Llamas, Suren Baghdasaryan,
	Dennis Dalessandro, Jason Gunthorpe, Leon Romanovsky, Brad Warrum,
	Ritu Agarwal, Eric Van Hensbergen, Latchesar Ionkov,
	Dominique Martinet, Christian Schoenebeck, David Sterba,
	David Howells, Marc Dionne, Alexander Viro, Ian Kent,
	Luis de Bethencourt, Salah Triki, Tigran A. Aivazian,
	Eric Biederman, Kees Cook, Chris Mason, Josef Bacik, Xiubo Li,
	Ilya Dryomov, Jan Harkes, coda, Joel Becker, Christoph Hellwig,
	Nicolas Pitre, Rafael J. Wysocki, Tyler Hicks, Ard Biesheuvel,
	Gao Xiang, Chao Yu, Yue Hu, Jeffle Xu, Namjae Jeon, Sungjong Seo,
	Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
	OGAWA Hirofumi, Miklos Szeredi, Bob Peterson, Andreas Gruenbacher,
	Richard Weinberger, Anton Ivanov, Johannes Berg, Mikulas Patocka,
	Mike Kravetz, Muchun Song, David Woodhouse, Dave Kleikamp,
	Tejun Heo, Trond Myklebust, Anna Schumaker, Chuck Lever,
	Ryusuke Konishi, Anton Altaparmakov, Konstantin Komarov,
	Mark Fasheh, Joseph Qi, Bob Copeland, Mike Marshall,
	Martin Brandenburg, Luis Chamberlain, Iurii Zaikin, Tony Luck,
	Guilherme G. Piccoli, Anders Larsen, Steve French,
	Paulo Alcantara, Ronnie Sahlberg, Shyam Prasad N, Tom Talpey,
	Sergey Senozhatsky, Phillip Lougher, Masami Hiramatsu,
	Evgeniy Dushistov, Hans de Goede, Darrick J. Wong, Damien Le Moal,
	Naohiro Aota, Johannes Thumshirn, Alexei Starovoitov,
	Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau, Song Liu,
	Yonghong Song, John Fastabend, KP Singh, Stanislav Fomichev,
	Hao Luo, Jiri Olsa, Hugh Dickins, Andrew Morton, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, John Johansen,
	Paul Moore, James Morris, Serge E. Hallyn, Stephen Smalley,
	Eric Paris, Juergen Gross, Ruihan Li, Laurent Pinchart,
	Wolfram Sang, Udipto Goswami, Linyu Yuan, John Keeping,
	Andrzej Pietrasiewicz, Dan Carpenter, Yuta Hayama,
	Jozef Martiniak, Jens Axboe, Alan Stern, Sandeep Dhavale,
	Dave Chinner, Johannes Weiner, ZhangPeng, Viacheslav Dubeyko,
	Tetsuo Handa, Aditya Garg, Erez Zadok, Yifei Liu, Yu Zhe,
	Matthew Wilcox (Oracle), Oleg Kanatov, Dr. David Alan Gilbert,
	Jiangshan Yi, xu xin, Stefan Roesch, Zhihao Cheng,
	Liam R. Howlett, Alexey Dobriyan, Minghao Chi, Seth Forshee,
	Zeng Jingxiang, Bart Van Assche, Mimi Zohar, Roberto Sassu,
	Zhang Yi, Tom Rix, Fabio M. De Francesco, Chen Zhongjin,
	Zhengchao Shao, Rik van Riel, Jingyu Wang, Hangyu Hua,
	linuxppc-dev, linux-kernel, linux-s390, linux-rdma, linux-usb,
	v9fs, linux-fsdevel, linux-afs, autofs, linux-mm, linux-btrfs,
	ceph-devel, codalist, ecryptfs, linux-efi, linux-erofs,
	linux-ext4, linux-f2fs-devel, cluster-devel, linux-um, linux-mtd,
	jfs-discussion, linux-nfs, linux-nilfs, linux-ntfs-dev, ntfs3,
	ocfs2-devel, linux-karma-devel, devel, linux-unionfs,
	linux-hardening, reiserfs-devel, linux-cifs, samba-technical,
	linux-trace-kernel, linux-xfs, bpf, netdev, apparmor,
	linux-security-module, selinux

On Wed, Jun 21, 2023 at 03:52:27PM -0400, Jeff Layton wrote:
> On Wed, 2023-06-21 at 15:21 -0400, Steven Rostedt wrote:
> > On Wed, 21 Jun 2023 10:45:05 -0400
> > Jeff Layton <jlayton@kernel.org> wrote:
> > 
> > > Most of this conversion was done via coccinelle, with a few of the more
> > > non-standard accesses done by hand. There should be no behavioral
> > > changes with this set. That will come later, as we convert individual
> > > filesystems to use multigrain timestamps.
> > 
> > BTW, Linus has suggested to me that whenever a conccinelle script is used,
> > it should be included in the change log.
> > 
> 
> Ok, here's what I have. I note again that my usage of coccinelle is
> pretty primitive, so I ended up doing a fair bit of by-hand fixing after
> applying these.
> 
> Given the way that this change is broken up into 77 patches by
> subsystem, to which changelogs should I add it? I could add it to the
> "infrastructure" patch, but that's the one where I _didn't_ use it. 
> 
> Maybe to patch #79 (the one that renames i_ctime)?

That works. I can also put this into a merge commit or pr message.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 00/79] fs: new accessors for inode->i_ctime
       [not found] ` <20230621152141.5961cf5f@gandalf.local.home>
       [not found]   ` <2a5a069572b46b59dd16fe8d54e549a9b5bbb6eb.camel@kernel.org>
@ 2023-06-30 22:11   ` Luis Chamberlain
  1 sibling, 0 replies; 24+ messages in thread
From: Luis Chamberlain @ 2023-06-30 22:11 UTC (permalink / raw)
  To: Steven Rostedt, Julia Lawall, Takashi Iwai
  Cc: Jeff Layton, Jeremy Kerr, Arnd Bergmann, Michael Ellerman,
	Nicholas Piggin, Christophe Leroy, Heiko Carstens, Vasily Gorbik,
	Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
	Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
	Martijn Coenen, Joel Fernandes, Christian Brauner, Carlos Llamas,
	Suren Baghdasaryan, Dennis Dalessandro, Jason Gunthorpe,
	Leon Romanovsky, Brad Warrum, Ritu Agarwal, Eric Van Hensbergen,
	Latchesar Ionkov, Dominique Martinet, Christian Schoenebeck,
	David Sterba, David Howells, Marc Dionne, Alexander Viro,
	Ian Kent, Luis de Bethencourt, Salah Triki, Tigran A. Aivazian,
	Eric Biederman, Kees Cook, Chris Mason, Josef Bacik, Xiubo Li,
	Ilya Dryomov, Jan Harkes, coda, Joel Becker, Christoph Hellwig,
	Nicolas Pitre, Rafael J. Wysocki, Tyler Hicks, Ard Biesheuvel,
	Gao Xiang, Chao Yu, Yue Hu, Jeffle Xu, Namjae Jeon, Sungjong Seo,
	Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
	OGAWA Hirofumi, Miklos Szeredi, Bob Peterson, Andreas Gruenbacher,
	Richard Weinberger, Anton Ivanov, Johannes Berg, Mikulas Patocka,
	Mike Kravetz, Muchun Song, David Woodhouse, Dave Kleikamp,
	Tejun Heo, Trond Myklebust, Anna Schumaker, Chuck Lever,
	Ryusuke Konishi, Anton Altaparmakov, Konstantin Komarov,
	Mark Fasheh, Joseph Qi, Bob Copeland, Mike Marshall,
	Martin Brandenburg, Iurii Zaikin, Tony Luck, Guilherme G. Piccoli,
	Anders Larsen, Steve French, Paulo Alcantara, Ronnie Sahlberg,
	Shyam Prasad N, Tom Talpey, Sergey Senozhatsky, Phillip Lougher,
	Masami Hiramatsu, Evgeniy Dushistov, Hans de Goede,
	Darrick J. Wong, Damien Le Moal, Naohiro Aota, Johannes Thumshirn,
	Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa, Hugh Dickins,
	Andrew Morton, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, John Johansen, Paul Moore, James Morris,
	Serge E. Hallyn, Stephen Smalley, Eric Paris, Juergen Gross,
	Ruihan Li, Laurent Pinchart, Wolfram Sang, Udipto Goswami,
	Linyu Yuan, John Keeping, Andrzej Pietrasiewicz, Dan Carpenter,
	Yuta Hayama, Jozef Martiniak, Jens Axboe, Alan Stern,
	Sandeep Dhavale, Dave Chinner, Johannes Weiner, ZhangPeng,
	Viacheslav Dubeyko, Tetsuo Handa, Aditya Garg, Erez Zadok,
	Yifei Liu, Yu Zhe, Matthew Wilcox (Oracle), Oleg Kanatov,
	Dr. David Alan Gilbert, Jiangshan Yi, xu xin, Stefan Roesch,
	Zhihao Cheng, Liam R. Howlett, Alexey Dobriyan, Minghao Chi,
	Seth Forshee, Zeng Jingxiang, Bart Van Assche, Mimi Zohar,
	Roberto Sassu, Zhang Yi, Tom Rix, Fabio M. De Francesco,
	Chen Zhongjin, Zhengchao Shao, Rik van Riel, Jingyu Wang,
	Hangyu Hua, linuxppc-dev, linux-kernel, linux-s390, linux-rdma,
	linux-usb, v9fs, linux-fsdevel, linux-afs, autofs, linux-mm,
	linux-btrfs, ceph-devel, codalist, ecryptfs, linux-efi,
	linux-erofs, linux-ext4, linux-f2fs-devel, cluster-devel,
	linux-um, linux-mtd, jfs-discussion, linux-nfs, linux-nilfs,
	linux-ntfs-dev, ntfs3, ocfs2-devel, linux-karma-devel, devel,
	linux-unionfs, linux-hardening, reiserfs-devel, linux-cifs,
	samba-technical, linux-trace-kernel, linux-xfs, bpf, netdev,
	apparmor, linux-security-module, selinux

On Wed, Jun 21, 2023 at 03:21:41PM -0400, Steven Rostedt wrote:
> On Wed, 21 Jun 2023 10:45:05 -0400
> Jeff Layton <jlayton@kernel.org> wrote:
> 
> > Most of this conversion was done via coccinelle, with a few of the more
> > non-standard accesses done by hand. There should be no behavioral
> > changes with this set. That will come later, as we convert individual
> > filesystems to use multigrain timestamps.
> 
> BTW, Linus has suggested to me that whenever a conccinelle script is used,
> it should be included in the change log.

Sometimes people like the coccinelle included in the commit, sometimes
people don't [0], it really ends up being up to a subjective maintainer
preference. A compromise could be to use git notes as these are
optional, however if we want to go down that path we should try to make
a general consensus on it so we can send a consistent message.

[0] https://lore.kernel.org/all/20230512073100.GC32559@twin.jikos.cz/

  Luis

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 01/79] fs: add ctime accessors infrastructure
       [not found] ` <20230621144507.55591-2-jlayton@kernel.org>
       [not found]   ` <99b3c749-23d9-6f09-fb75-6a84f3d1b066@kernel.org>
@ 2023-06-30 22:12   ` Luis Chamberlain
  2023-07-12 15:31   ` Randy Dunlap
  2 siblings, 0 replies; 24+ messages in thread
From: Luis Chamberlain @ 2023-06-30 22:12 UTC (permalink / raw)
  To: Jeff Layton
  Cc: Jeremy Kerr, Arnd Bergmann, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Heiko Carstens, Vasily Gorbik,
	Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
	Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
	Martijn Coenen, Joel Fernandes, Christian Brauner, Carlos Llamas,
	Suren Baghdasaryan, Dennis Dalessandro, Jason Gunthorpe,
	Leon Romanovsky, Brad Warrum, Ritu Agarwal, Eric Van Hensbergen,
	Latchesar Ionkov, Dominique Martinet, Christian Schoenebeck,
	David Sterba, David Howells, Marc Dionne, Alexander Viro,
	Ian Kent, Luis de Bethencourt, Salah Triki, Tigran A. Aivazian,
	Eric Biederman, Kees Cook, Chris Mason, Josef Bacik, Xiubo Li,
	Ilya Dryomov, Jan Harkes, coda, Joel Becker, Christoph Hellwig,
	Nicolas Pitre, Rafael J. Wysocki, Tyler Hicks, Ard Biesheuvel,
	Gao Xiang, Chao Yu, Yue Hu, Jeffle Xu, Namjae Jeon, Sungjong Seo,
	Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
	OGAWA Hirofumi, Miklos Szeredi, Bob Peterson, Andreas Gruenbacher,
	Richard Weinberger, Anton Ivanov, Johannes Berg, Mikulas Patocka,
	Mike Kravetz, Muchun Song, David Woodhouse, Dave Kleikamp,
	Tejun Heo, Trond Myklebust, Anna Schumaker, Chuck Lever,
	Ryusuke Konishi, Anton Altaparmakov, Konstantin Komarov,
	Mark Fasheh, Joseph Qi, Bob Copeland, Mike Marshall,
	Martin Brandenburg, Iurii Zaikin, Tony Luck, Guilherme G. Piccoli,
	Anders Larsen, Steve French, Paulo Alcantara, Ronnie Sahlberg,
	Shyam Prasad N, Tom Talpey, Sergey Senozhatsky, Phillip Lougher,
	Steven Rostedt, Masami Hiramatsu, Evgeniy Dushistov,
	Hans de Goede, Darrick J. Wong, Damien Le Moal, Naohiro Aota,
	Johannes Thumshirn, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Hugh Dickins, Andrew Morton, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, John Johansen, Paul Moore,
	James Morris, Serge E. Hallyn, Stephen Smalley, Eric Paris,
	Juergen Gross, Ruihan Li, Laurent Pinchart, Wolfram Sang,
	Udipto Goswami, Linyu Yuan, John Keeping, Andrzej Pietrasiewicz,
	Dan Carpenter, Yuta Hayama, Jozef Martiniak, Jens Axboe,
	Alan Stern, Sandeep Dhavale, Dave Chinner, Johannes Weiner,
	ZhangPeng, Viacheslav Dubeyko, Tetsuo Handa, Aditya Garg,
	Erez Zadok, Yifei Liu, Yu Zhe, Matthew Wilcox (Oracle),
	Oleg Kanatov, Dr. David Alan Gilbert, Jiangshan Yi, xu xin,
	Stefan Roesch, Zhihao Cheng, Liam R. Howlett, Alexey Dobriyan,
	Minghao Chi, Seth Forshee, Zeng Jingxiang, Bart Van Assche,
	Mimi Zohar, Roberto Sassu, Zhang Yi, Tom Rix,
	Fabio M. De Francesco, Chen Zhongjin, Zhengchao Shao,
	Rik van Riel, Jingyu Wang, Hangyu Hua, linuxppc-dev, linux-kernel,
	linux-s390, linux-rdma, linux-usb, v9fs, linux-fsdevel, linux-afs,
	autofs, linux-mm, linux-btrfs, ceph-devel, codalist, ecryptfs,
	linux-efi, linux-erofs, linux-ext4, linux-f2fs-devel,
	cluster-devel, linux-um, linux-mtd, jfs-discussion, linux-nfs,
	linux-nilfs, linux-ntfs-dev, ntfs3, ocfs2-devel,
	linux-karma-devel, devel, linux-unionfs, linux-hardening,
	reiserfs-devel, linux-cifs, samba-technical, linux-trace-kernel,
	linux-xfs, bpf, netdev, apparmor, linux-security-module, selinux

On Wed, Jun 21, 2023 at 10:45:06AM -0400, Jeff Layton wrote:
> struct timespec64 has unused bits in the tv_nsec field that can be used
> for other purposes. In future patches, we're going to change how the
> inode->i_ctime is accessed in certain inodes in order to make use of
> them. In order to do that safely though, we'll need to eradicate raw
> accesses of the inode->i_ctime field from the kernel.
> 
> Add new accessor functions for the ctime that we can use to replace them.
> 
> Signed-off-by: Jeff Layton <jlayton@kernel.org>

Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>

  Luis

^ permalink raw reply	[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

* Re: [PATCH 15/79] bfs: switch to new ctime accessors
       [not found]               ` <20230623-kaffee-volumen-014cfa91a2ee@brauner>
@ 2023-07-03 10:12                 ` Christian Brauner
  2023-07-03 10:46                   ` Jeff Layton
  0 siblings, 1 reply; 24+ messages in thread
From: Christian Brauner @ 2023-07-03 10:12 UTC (permalink / raw)
  To: Jeff Layton
  Cc: Kara, Tigran A. Aivazian, Al Viro, linux-kernel, damien.lemoal,
	linux-fsdevel

On Fri, Jun 23, 2023 at 02:33:26PM +0200, Christian Brauner wrote:
> On Thu, Jun 22, 2023 at 04:57:47PM +0200, Jan Kara wrote:
> > On Thu 22-06-23 08:51:58, Jeff Layton wrote:
> > > On Thu, 2023-06-22 at 14:30 +0200, Jan Kara wrote:
> > > > On Wed 21-06-23 12:57:19, Jeff Layton wrote:
> > > > > On Wed, 2023-06-21 at 18:48 +0200, Jan Kara wrote:
> > > > > > On Wed 21-06-23 10:45:28, 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>
> > > > > > 
> > > > > > ...
> > > > > > 
> > > > > > > diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c
> > > > > > > index 1926bec2c850..c964316be32b 100644
> > > > > > > --- a/fs/bfs/inode.c
> > > > > > > +++ b/fs/bfs/inode.c
> > > > > > > @@ -82,10 +82,10 @@ struct inode *bfs_iget(struct super_block *sb, unsigned long ino)
> > > > > > >  	inode->i_blocks = BFS_FILEBLOCKS(di);
> > > > > > >  	inode->i_atime.tv_sec =  le32_to_cpu(di->i_atime);
> > > > > > >  	inode->i_mtime.tv_sec =  le32_to_cpu(di->i_mtime);
> > > > > > > -	inode->i_ctime.tv_sec =  le32_to_cpu(di->i_ctime);
> > > > > > > +	inode_ctime_set_sec(inode, le32_to_cpu(di->i_ctime));
> > > > > > >  	inode->i_atime.tv_nsec = 0;
> > > > > > >  	inode->i_mtime.tv_nsec = 0;
> > > > > > > -	inode->i_ctime.tv_nsec = 0;
> > > > > > > +	inode_ctime_set_nsec(inode, 0);
> > > > > > 
> > > > > > So I'm somewhat wondering here - in other filesystem you construct
> > > > > > timespec64 and then use inode_ctime_set(). Here you use
> > > > > > inode_ctime_set_sec() + inode_ctime_set_nsec(). What's the benefit? It
> > > > > > seems these two functions are not used that much some maybe we could just
> > > > > > live with just inode_ctime_set() and constructing timespec64 when needed?
> > > > > > 
> > > > > > 								Honza
> > > > > 
> > > > > The main advantage is that by using that, I didn't need to do quite so
> > > > > much of this conversion by hand. My coccinelle skills are pretty
> > > > > primitive. I went with whatever conversion was going to give minimal
> > > > > changes, to the existing accesses for the most part.
> > > > > 
> > > > > We could certainly do it the way you suggest, it just means having to
> > > > > re-touch a lot of this code by hand, or someone with better coccinelle
> > > > > chops suggesting a way to declare a temporary variables in place.
> > > > 
> > > > Well, maybe temporary variables aren't that convenient but we could provide
> > > > function setting ctime from sec & nsec value without having to declare
> > > > temporary timespec64? Attached is a semantic patch that should deal with
> > > > that - at least it seems to handle all the cases I've found.
> > > > 
> > > 
> > > Ok, let me try respinning this with your cocci script and see how it
> > > looks.
> > > 
> > > Damien also suggested in a reply to the zonefs patch a preference for
> > > the naming style you have above. Should I also rename these like?
> > > 
> > >     inode_ctime_peek -> inode_get_ctime
> > >     inode_ctime_set -> inode_set_ctime
> > > 
> > > This would be the time to change it if that's preferred.
> > 
> > I don't really care much so whatever you decide is better :)
> 
> I have a mild preference for inode_{get,set}_ctime().

Jeff, did you plan on sending a v2 with this renamed or do you want me
to pick this up now?

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 15/79] bfs: switch to new ctime accessors
  2023-07-03 10:12                 ` [PATCH 15/79] bfs: " Christian Brauner
@ 2023-07-03 10:46                   ` Jeff Layton
  2023-07-03 10:57                     ` Christian Brauner
  0 siblings, 1 reply; 24+ messages in thread
From: Jeff Layton @ 2023-07-03 10:46 UTC (permalink / raw)
  To: Christian Brauner
  Cc: Kara, Tigran A. Aivazian, Al Viro, linux-kernel, damien.lemoal,
	linux-fsdevel

On Mon, 2023-07-03 at 12:12 +0200, Christian Brauner wrote:
> On Fri, Jun 23, 2023 at 02:33:26PM +0200, Christian Brauner wrote:
> > On Thu, Jun 22, 2023 at 04:57:47PM +0200, Jan Kara wrote:
> > > On Thu 22-06-23 08:51:58, Jeff Layton wrote:
> > > > On Thu, 2023-06-22 at 14:30 +0200, Jan Kara wrote:
> > > > > On Wed 21-06-23 12:57:19, Jeff Layton wrote:
> > > > > > On Wed, 2023-06-21 at 18:48 +0200, Jan Kara wrote:
> > > > > > > On Wed 21-06-23 10:45:28, 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>
> > > > > > > 
> > > > > > > ...
> > > > > > > 
> > > > > > > > diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c
> > > > > > > > index 1926bec2c850..c964316be32b 100644
> > > > > > > > --- a/fs/bfs/inode.c
> > > > > > > > +++ b/fs/bfs/inode.c
> > > > > > > > @@ -82,10 +82,10 @@ struct inode *bfs_iget(struct super_block *sb, unsigned long ino)
> > > > > > > >  	inode->i_blocks = BFS_FILEBLOCKS(di);
> > > > > > > >  	inode->i_atime.tv_sec =  le32_to_cpu(di->i_atime);
> > > > > > > >  	inode->i_mtime.tv_sec =  le32_to_cpu(di->i_mtime);
> > > > > > > > -	inode->i_ctime.tv_sec =  le32_to_cpu(di->i_ctime);
> > > > > > > > +	inode_ctime_set_sec(inode, le32_to_cpu(di->i_ctime));
> > > > > > > >  	inode->i_atime.tv_nsec = 0;
> > > > > > > >  	inode->i_mtime.tv_nsec = 0;
> > > > > > > > -	inode->i_ctime.tv_nsec = 0;
> > > > > > > > +	inode_ctime_set_nsec(inode, 0);
> > > > > > > 
> > > > > > > So I'm somewhat wondering here - in other filesystem you construct
> > > > > > > timespec64 and then use inode_ctime_set(). Here you use
> > > > > > > inode_ctime_set_sec() + inode_ctime_set_nsec(). What's the benefit? It
> > > > > > > seems these two functions are not used that much some maybe we could just
> > > > > > > live with just inode_ctime_set() and constructing timespec64 when needed?
> > > > > > > 
> > > > > > > 								Honza
> > > > > > 
> > > > > > The main advantage is that by using that, I didn't need to do quite so
> > > > > > much of this conversion by hand. My coccinelle skills are pretty
> > > > > > primitive. I went with whatever conversion was going to give minimal
> > > > > > changes, to the existing accesses for the most part.
> > > > > > 
> > > > > > We could certainly do it the way you suggest, it just means having to
> > > > > > re-touch a lot of this code by hand, or someone with better coccinelle
> > > > > > chops suggesting a way to declare a temporary variables in place.
> > > > > 
> > > > > Well, maybe temporary variables aren't that convenient but we could provide
> > > > > function setting ctime from sec & nsec value without having to declare
> > > > > temporary timespec64? Attached is a semantic patch that should deal with
> > > > > that - at least it seems to handle all the cases I've found.
> > > > > 
> > > > 
> > > > Ok, let me try respinning this with your cocci script and see how it
> > > > looks.
> > > > 
> > > > Damien also suggested in a reply to the zonefs patch a preference for
> > > > the naming style you have above. Should I also rename these like?
> > > > 
> > > >     inode_ctime_peek -> inode_get_ctime
> > > >     inode_ctime_set -> inode_set_ctime
> > > > 
> > > > This would be the time to change it if that's preferred.
> > > 
> > > I don't really care much so whatever you decide is better :)
> > 
> > I have a mild preference for inode_{get,set}_ctime().
> 
> Jeff, did you plan on sending a v2 with this renamed or do you want me
> to pick this up now?

I'm working on a new set that I'll send out in a few days. Sorry it has
taken a while, I spent quite a bit of time trying to improve my
coccinelle chops for this.

Thanks,
-- 
Jeff Layton <jlayton@kernel.org>

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 15/79] bfs: switch to new ctime accessors
  2023-07-03 10:46                   ` Jeff Layton
@ 2023-07-03 10:57                     ` Christian Brauner
  0 siblings, 0 replies; 24+ messages in thread
From: Christian Brauner @ 2023-07-03 10:57 UTC (permalink / raw)
  To: Jeff Layton
  Cc: Kara, Tigran A. Aivazian, Al Viro, linux-kernel, damien.lemoal,
	linux-fsdevel

On Mon, Jul 03, 2023 at 06:46:33AM -0400, Jeff Layton wrote:
> On Mon, 2023-07-03 at 12:12 +0200, Christian Brauner wrote:
> > On Fri, Jun 23, 2023 at 02:33:26PM +0200, Christian Brauner wrote:
> > > On Thu, Jun 22, 2023 at 04:57:47PM +0200, Jan Kara wrote:
> > > > On Thu 22-06-23 08:51:58, Jeff Layton wrote:
> > > > > On Thu, 2023-06-22 at 14:30 +0200, Jan Kara wrote:
> > > > > > On Wed 21-06-23 12:57:19, Jeff Layton wrote:
> > > > > > > On Wed, 2023-06-21 at 18:48 +0200, Jan Kara wrote:
> > > > > > > > On Wed 21-06-23 10:45:28, 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>
> > > > > > > > 
> > > > > > > > ...
> > > > > > > > 
> > > > > > > > > diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c
> > > > > > > > > index 1926bec2c850..c964316be32b 100644
> > > > > > > > > --- a/fs/bfs/inode.c
> > > > > > > > > +++ b/fs/bfs/inode.c
> > > > > > > > > @@ -82,10 +82,10 @@ struct inode *bfs_iget(struct super_block *sb, unsigned long ino)
> > > > > > > > >  	inode->i_blocks = BFS_FILEBLOCKS(di);
> > > > > > > > >  	inode->i_atime.tv_sec =  le32_to_cpu(di->i_atime);
> > > > > > > > >  	inode->i_mtime.tv_sec =  le32_to_cpu(di->i_mtime);
> > > > > > > > > -	inode->i_ctime.tv_sec =  le32_to_cpu(di->i_ctime);
> > > > > > > > > +	inode_ctime_set_sec(inode, le32_to_cpu(di->i_ctime));
> > > > > > > > >  	inode->i_atime.tv_nsec = 0;
> > > > > > > > >  	inode->i_mtime.tv_nsec = 0;
> > > > > > > > > -	inode->i_ctime.tv_nsec = 0;
> > > > > > > > > +	inode_ctime_set_nsec(inode, 0);
> > > > > > > > 
> > > > > > > > So I'm somewhat wondering here - in other filesystem you construct
> > > > > > > > timespec64 and then use inode_ctime_set(). Here you use
> > > > > > > > inode_ctime_set_sec() + inode_ctime_set_nsec(). What's the benefit? It
> > > > > > > > seems these two functions are not used that much some maybe we could just
> > > > > > > > live with just inode_ctime_set() and constructing timespec64 when needed?
> > > > > > > > 
> > > > > > > > 								Honza
> > > > > > > 
> > > > > > > The main advantage is that by using that, I didn't need to do quite so
> > > > > > > much of this conversion by hand. My coccinelle skills are pretty
> > > > > > > primitive. I went with whatever conversion was going to give minimal
> > > > > > > changes, to the existing accesses for the most part.
> > > > > > > 
> > > > > > > We could certainly do it the way you suggest, it just means having to
> > > > > > > re-touch a lot of this code by hand, or someone with better coccinelle
> > > > > > > chops suggesting a way to declare a temporary variables in place.
> > > > > > 
> > > > > > Well, maybe temporary variables aren't that convenient but we could provide
> > > > > > function setting ctime from sec & nsec value without having to declare
> > > > > > temporary timespec64? Attached is a semantic patch that should deal with
> > > > > > that - at least it seems to handle all the cases I've found.
> > > > > > 
> > > > > 
> > > > > Ok, let me try respinning this with your cocci script and see how it
> > > > > looks.
> > > > > 
> > > > > Damien also suggested in a reply to the zonefs patch a preference for
> > > > > the naming style you have above. Should I also rename these like?
> > > > > 
> > > > >     inode_ctime_peek -> inode_get_ctime
> > > > >     inode_ctime_set -> inode_set_ctime
> > > > > 
> > > > > This would be the time to change it if that's preferred.
> > > > 
> > > > I don't really care much so whatever you decide is better :)
> > > 
> > > I have a mild preference for inode_{get,set}_ctime().
> > 
> > Jeff, did you plan on sending a v2 with this renamed or do you want me
> > to pick this up now?
> 
> I'm working on a new set that I'll send out in a few days. Sorry it has
> taken a while, I spent quite a bit of time trying to improve my
> coccinelle chops for this.

Absolutely no problem of course. I just wanted to check that I didn't
pointlessly delay you by not taking care of this.

Thanks!

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 01/79] fs: add ctime accessors infrastructure
       [not found] ` <20230621144507.55591-2-jlayton@kernel.org>
       [not found]   ` <99b3c749-23d9-6f09-fb75-6a84f3d1b066@kernel.org>
  2023-06-30 22:12   ` Luis Chamberlain
@ 2023-07-12 15:31   ` Randy Dunlap
  2023-07-12 15:34     ` Christian Brauner
  2 siblings, 1 reply; 24+ messages in thread
From: Randy Dunlap @ 2023-07-12 15:31 UTC (permalink / raw)
  To: Jeff Layton, linux-kernel@vger.kernel.org,
	Linux FS-devel Mailing List, linux-um

Hi Jeff,

On arch/um/, (subarch i386 or x86_64), hostfs build fails with:

../fs/hostfs/hostfs_kern.c:520:36: error: incompatible type for arg
ument 2 of 'inode_set_ctime_to_ts'
../include/linux/fs.h:1499:73: note: expected 'struct timespec64' b
ut argument is of type 'const struct hostfs_timespec *'


-- 
~Randy

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 01/79] fs: add ctime accessors infrastructure
  2023-07-12 15:31   ` Randy Dunlap
@ 2023-07-12 15:34     ` Christian Brauner
  0 siblings, 0 replies; 24+ messages in thread
From: Christian Brauner @ 2023-07-12 15:34 UTC (permalink / raw)
  To: Randy Dunlap
  Cc: Jeff Layton, linux-kernel@vger.kernel.org,
	Linux FS-devel Mailing List, linux-um

On Wed, Jul 12, 2023 at 08:31:55AM -0700, Randy Dunlap wrote:
> Hi Jeff,
> 
> On arch/um/, (subarch i386 or x86_64), hostfs build fails with:
> 
> ../fs/hostfs/hostfs_kern.c:520:36: error: incompatible type for arg
> ument 2 of 'inode_set_ctime_to_ts'
> ../include/linux/fs.h:1499:73: note: expected 'struct timespec64' b
> ut argument is of type 'const struct hostfs_timespec *'

Thanks for notifying us! We fixed this earlier today. The vfs.ctime
branch has been updated with the fix folded into the hostfs patch.

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2023-07-12 15:34 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20230621144507.55591-1-jlayton@kernel.org>
     [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 16:39     ` Jan Kara
2023-06-22 11:37     ` David Sterba
2023-06-21 14:45   ` [PATCH 12/79] fs: " Jeff Layton
2023-06-21 16:42     ` Jan Kara
2023-06-21 14:45   ` [PATCH 27/79] exfat: " Jeff Layton
2023-06-21 14:45   ` [PATCH 33/79] fuse: " Jeff Layton
2023-06-21 14:45   ` [PATCH 35/79] hfs: " Jeff Layton
2023-06-21 14:45   ` [PATCH 36/79] hfsplus: " Jeff Layton
2023-06-21 14:45   ` [PATCH 40/79] isofs: " Jeff Layton
2023-06-21 14:46   ` [PATCH 55/79] proc: " Jeff Layton
2023-06-30 22:13     ` Luis Chamberlain
2023-06-21 14:46   ` [PATCH 69/79] vboxsf: " Jeff Layton
2023-06-21 14:46   ` [PATCH 71/79] zonefs: " Jeff Layton
2023-06-22  0:48     ` Damien Le Moal
     [not found]   ` <20230621144735.55953-14-jlayton@kernel.org>
     [not found]     ` <20230621164808.5lhujni7qb36hhtk@quack3>
     [not found]       ` <646b7283ede4945b335ad16aea5ff60e1361241e.camel@kernel.org>
     [not found]         ` <20230622123050.thpf7qdnmidq3thj@quack3>
     [not found]           ` <d316dca7c248693575dae3d8032e9e3332bbae7a.camel@kernel.org>
     [not found]             ` <20230622145747.lokguccxtrrpgb3b@quack3>
     [not found]               ` <20230623-kaffee-volumen-014cfa91a2ee@brauner>
2023-07-03 10:12                 ` [PATCH 15/79] bfs: " Christian Brauner
2023-07-03 10:46                   ` Jeff Layton
2023-07-03 10:57                     ` Christian Brauner
     [not found] ` <20230621152141.5961cf5f@gandalf.local.home>
     [not found]   ` <2a5a069572b46b59dd16fe8d54e549a9b5bbb6eb.camel@kernel.org>
2023-06-23 12:41     ` [PATCH 00/79] fs: new accessors for inode->i_ctime Christian Brauner
2023-06-30 22:11   ` Luis Chamberlain
     [not found] ` <20230621144507.55591-2-jlayton@kernel.org>
     [not found]   ` <99b3c749-23d9-6f09-fb75-6a84f3d1b066@kernel.org>
2023-06-22 10:14     ` [PATCH 01/79] fs: add ctime accessors infrastructure Jeff Layton
2023-06-30 22:12   ` Luis Chamberlain
2023-07-12 15:31   ` Randy Dunlap
2023-07-12 15:34     ` Christian Brauner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).