* [PATCH v2 11/92] shmem: convert to simple_rename_timestamp
[not found] ` <20230705190309.579783-1-jlayton@kernel.org>
@ 2023-07-05 19:00 ` Jeff Layton
2023-07-06 10:33 ` Jan Kara
2023-07-05 19:00 ` [PATCH v2 25/92] fs: convert to ctime accessor functions Jeff Layton
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Jeff Layton @ 2023-07-05 19:00 UTC (permalink / raw)
To: Christian Brauner, Hugh Dickins, Andrew Morton
Cc: Al Viro, Jan Kara, linux-fsdevel, linux-kernel, linux-mm
A rename potentially involves updating 4 different inode timestamps.
Convert to the new simple_rename_timestamp helper function.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
mm/shmem.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/mm/shmem.c b/mm/shmem.c
index 0f45e72a5ca7..1693134959c5 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -3306,9 +3306,7 @@ static int shmem_rename2(struct mnt_idmap *idmap,
old_dir->i_size -= BOGO_DIRENT_SIZE;
new_dir->i_size += BOGO_DIRENT_SIZE;
- old_dir->i_ctime = old_dir->i_mtime =
- new_dir->i_ctime = new_dir->i_mtime =
- inode->i_ctime = current_time(old_dir);
+ simple_rename_timestamp(old_dir, old_dentry, new_dir, new_dentry);
inode_inc_iversion(old_dir);
inode_inc_iversion(new_dir);
return 0;
--
2.41.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 25/92] fs: convert to ctime accessor functions
[not found] ` <20230705190309.579783-1-jlayton@kernel.org>
2023-07-05 19:00 ` [PATCH v2 11/92] shmem: convert to simple_rename_timestamp Jeff Layton
@ 2023-07-05 19:00 ` Jeff Layton
2023-07-05 19:01 ` [PATCH v2 52/92] hugetlbfs: " Jeff Layton
2023-07-05 19:01 ` [PATCH v2 87/92] shmem: " Jeff Layton
3 siblings, 0 replies; 8+ messages in thread
From: Jeff Layton @ 2023-07-05 19:00 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 inode's ctime field is
used. Switch to using accessor functions instead of raw accesses of
inode->i_ctime.
Reviewed-by: Jan Kara <jack@suse.cz>
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 | 10 +++++++---
fs/nsfs.c | 2 +-
fs/pipe.c | 2 +-
fs/posix_acl.c | 2 +-
fs/stack.c | 2 +-
fs/stat.c | 2 +-
9 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/fs/attr.c b/fs/attr.c
index d60dc1edb526..599f6d14c0ed 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_set_ctime_to_ts(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..6e21f7412a85 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_set_ctime_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..e0108d17b085 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_set_ctime_current(inode);
}
return inode;
}
diff --git a/fs/inode.c b/fs/inode.c
index 21b026d95b51..32e08c3fa9ff 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_get_ctime(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_set_ctime_to_ts(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_get_ctime(inode);
+ if (!timespec64_equal(&ctime, now))
sync_it |= S_CTIME;
if (IS_I_VERSION(inode) && inode_iversion_need_inc(inode))
diff --git a/fs/nsfs.c b/fs/nsfs.c
index f602a96a1afe..647a22433bd8 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_set_ctime_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..174682103669 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_set_ctime_current(inode);
return inode;
diff --git a/fs/posix_acl.c b/fs/posix_acl.c
index 7fa1b738bbab..a05fe94970ce 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_set_ctime_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..b5e01bdb5f5f 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_set_ctime_to_ts(dest, inode_get_ctime(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..8c2b30af19f5 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_get_ctime(inode);
stat->blksize = i_blocksize(inode);
stat->blocks = inode->i_blocks;
}
--
2.41.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 52/92] hugetlbfs: convert to ctime accessor functions
[not found] ` <20230705190309.579783-1-jlayton@kernel.org>
2023-07-05 19:00 ` [PATCH v2 11/92] shmem: convert to simple_rename_timestamp Jeff Layton
2023-07-05 19:00 ` [PATCH v2 25/92] fs: convert to ctime accessor functions Jeff Layton
@ 2023-07-05 19:01 ` Jeff Layton
2023-07-05 19:58 ` Mike Kravetz
2023-07-06 12:40 ` Jan Kara
2023-07-05 19:01 ` [PATCH v2 87/92] shmem: " Jeff Layton
3 siblings, 2 replies; 8+ messages in thread
From: Jeff Layton @ 2023-07-05 19:01 UTC (permalink / raw)
To: Christian Brauner, Mike Kravetz, Muchun Song
Cc: Al Viro, Jan Kara, linux-fsdevel, linux-kernel, linux-mm
In later patches, we're going to change how the inode's ctime field is
used. Switch to using accessor functions instead of raw accesses of
inode->i_ctime.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/hugetlbfs/inode.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 7b17ccfa039d..93d3bcfd4fc8 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -887,7 +887,7 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset,
if (!(mode & FALLOC_FL_KEEP_SIZE) && offset + len > inode->i_size)
i_size_write(inode, offset + len);
- inode->i_ctime = current_time(inode);
+ inode_set_ctime_current(inode);
out:
inode_unlock(inode);
return error;
@@ -935,7 +935,7 @@ static struct inode *hugetlbfs_get_root(struct super_block *sb,
inode->i_mode = S_IFDIR | ctx->mode;
inode->i_uid = ctx->uid;
inode->i_gid = ctx->gid;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
+ inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode);
inode->i_op = &hugetlbfs_dir_inode_operations;
inode->i_fop = &simple_dir_operations;
/* directory inodes start off with i_nlink == 2 (for "." entry) */
@@ -979,7 +979,7 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb,
lockdep_set_class(&inode->i_mapping->i_mmap_rwsem,
&hugetlbfs_i_mmap_rwsem_key);
inode->i_mapping->a_ops = &hugetlbfs_aops;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
+ inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode);
inode->i_mapping->private_data = resv_map;
info->seals = F_SEAL_SEAL;
switch (mode & S_IFMT) {
@@ -1022,7 +1022,7 @@ static int hugetlbfs_mknod(struct mnt_idmap *idmap, struct inode *dir,
inode = hugetlbfs_get_inode(dir->i_sb, dir, mode, dev);
if (!inode)
return -ENOSPC;
- dir->i_ctime = dir->i_mtime = current_time(dir);
+ dir->i_mtime = inode_set_ctime_current(dir);
d_instantiate(dentry, inode);
dget(dentry);/* Extra count - pin the dentry in core */
return 0;
@@ -1054,7 +1054,7 @@ static int hugetlbfs_tmpfile(struct mnt_idmap *idmap,
inode = hugetlbfs_get_inode(dir->i_sb, dir, mode | S_IFREG, 0);
if (!inode)
return -ENOSPC;
- dir->i_ctime = dir->i_mtime = current_time(dir);
+ dir->i_mtime = inode_set_ctime_current(dir);
d_tmpfile(file, inode);
return finish_open_simple(file, 0);
}
@@ -1076,7 +1076,7 @@ static int hugetlbfs_symlink(struct mnt_idmap *idmap,
} else
iput(inode);
}
- dir->i_ctime = dir->i_mtime = current_time(dir);
+ dir->i_mtime = inode_set_ctime_current(dir);
return error;
}
--
2.41.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 87/92] shmem: convert to ctime accessor functions
[not found] ` <20230705190309.579783-1-jlayton@kernel.org>
` (2 preceding siblings ...)
2023-07-05 19:01 ` [PATCH v2 52/92] hugetlbfs: " Jeff Layton
@ 2023-07-05 19:01 ` Jeff Layton
2023-07-06 14:56 ` Jan Kara
3 siblings, 1 reply; 8+ messages in thread
From: Jeff Layton @ 2023-07-05 19:01 UTC (permalink / raw)
To: Christian Brauner, Hugh Dickins, Andrew Morton
Cc: Al Viro, Jan Kara, linux-fsdevel, linux-kernel, linux-mm
In later patches, we're going to change how the inode's ctime field is
used. Switch to using accessor functions instead of raw accesses of
inode->i_ctime.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
mm/shmem.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/mm/shmem.c b/mm/shmem.c
index 1693134959c5..51aaaf479437 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1064,7 +1064,7 @@ static void shmem_undo_range(struct inode *inode, loff_t lstart, loff_t lend,
void shmem_truncate_range(struct inode *inode, loff_t lstart, loff_t lend)
{
shmem_undo_range(inode, lstart, lend, false);
- inode->i_ctime = inode->i_mtime = current_time(inode);
+ inode->i_mtime = inode_set_ctime_current(inode);
inode_inc_iversion(inode);
}
EXPORT_SYMBOL_GPL(shmem_truncate_range);
@@ -1161,9 +1161,9 @@ static int shmem_setattr(struct mnt_idmap *idmap,
if (attr->ia_valid & ATTR_MODE)
error = posix_acl_chmod(idmap, dentry, inode->i_mode);
if (!error && update_ctime) {
- inode->i_ctime = current_time(inode);
+ inode_set_ctime_current(inode);
if (update_mtime)
- inode->i_mtime = inode->i_ctime;
+ inode->i_mtime = inode_get_ctime(inode);
inode_inc_iversion(inode);
}
return error;
@@ -2394,7 +2394,7 @@ static struct inode *shmem_get_inode(struct mnt_idmap *idmap, struct super_block
inode->i_ino = ino;
inode_init_owner(idmap, inode, dir, mode);
inode->i_blocks = 0;
- inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
+ inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode);
inode->i_generation = get_random_u32();
info = SHMEM_I(inode);
memset(info, 0, (char *)inode - (char *)info);
@@ -3110,7 +3110,7 @@ shmem_mknod(struct mnt_idmap *idmap, struct inode *dir,
goto out_iput;
dir->i_size += BOGO_DIRENT_SIZE;
- dir->i_ctime = dir->i_mtime = current_time(dir);
+ dir->i_mtime = inode_set_ctime_current(dir);
inode_inc_iversion(dir);
d_instantiate(dentry, inode);
dget(dentry); /* Extra count - pin the dentry in core */
@@ -3193,7 +3193,8 @@ static int shmem_link(struct dentry *old_dentry, struct inode *dir, struct dentr
}
dir->i_size += BOGO_DIRENT_SIZE;
- inode->i_ctime = dir->i_ctime = dir->i_mtime = current_time(inode);
+ dir->i_mtime = inode_set_ctime_to_ts(dir,
+ inode_set_ctime_current(inode));
inode_inc_iversion(dir);
inc_nlink(inode);
ihold(inode); /* New dentry reference */
@@ -3213,7 +3214,8 @@ static int shmem_unlink(struct inode *dir, struct dentry *dentry)
simple_offset_remove(shmem_get_offset_ctx(dir), dentry);
dir->i_size -= BOGO_DIRENT_SIZE;
- inode->i_ctime = dir->i_ctime = dir->i_mtime = current_time(inode);
+ dir->i_mtime = inode_set_ctime_to_ts(dir,
+ inode_set_ctime_current(inode));
inode_inc_iversion(dir);
drop_nlink(inode);
dput(dentry); /* Undo the count from "create" - this does all the work */
@@ -3360,7 +3362,7 @@ static int shmem_symlink(struct mnt_idmap *idmap, struct inode *dir,
folio_put(folio);
}
dir->i_size += BOGO_DIRENT_SIZE;
- dir->i_ctime = dir->i_mtime = current_time(dir);
+ dir->i_mtime = inode_set_ctime_current(dir);
inode_inc_iversion(dir);
d_instantiate(dentry, inode);
dget(dentry);
@@ -3438,7 +3440,7 @@ static int shmem_fileattr_set(struct mnt_idmap *idmap,
(fa->flags & SHMEM_FL_USER_MODIFIABLE);
shmem_set_inode_flags(inode, info->fsflags);
- inode->i_ctime = current_time(inode);
+ inode_set_ctime_current(inode);
inode_inc_iversion(inode);
return 0;
}
@@ -3508,7 +3510,7 @@ static int shmem_xattr_handler_set(const struct xattr_handler *handler,
name = xattr_full_name(handler, name);
err = simple_xattr_set(&info->xattrs, name, value, size, flags, NULL);
if (!err) {
- inode->i_ctime = current_time(inode);
+ inode_set_ctime_current(inode);
inode_inc_iversion(inode);
}
return err;
--
2.41.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 52/92] hugetlbfs: convert to ctime accessor functions
2023-07-05 19:01 ` [PATCH v2 52/92] hugetlbfs: " Jeff Layton
@ 2023-07-05 19:58 ` Mike Kravetz
2023-07-06 12:40 ` Jan Kara
1 sibling, 0 replies; 8+ messages in thread
From: Mike Kravetz @ 2023-07-05 19:58 UTC (permalink / raw)
To: Jeff Layton
Cc: Christian Brauner, Muchun Song, Al Viro, Jan Kara, linux-fsdevel,
linux-kernel, linux-mm
On 07/05/23 15:01, Jeff Layton wrote:
> In later patches, we're going to change how the inode's ctime field is
> used. Switch to using accessor functions instead of raw accesses of
> inode->i_ctime.
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
> fs/hugetlbfs/inode.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
Looks straight forward,
Acked-by: Mike Kravetz <mike.kravetz@oracle.com>
--
Mike Kravetz
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 11/92] shmem: convert to simple_rename_timestamp
2023-07-05 19:00 ` [PATCH v2 11/92] shmem: convert to simple_rename_timestamp Jeff Layton
@ 2023-07-06 10:33 ` Jan Kara
0 siblings, 0 replies; 8+ messages in thread
From: Jan Kara @ 2023-07-06 10:33 UTC (permalink / raw)
To: Jeff Layton
Cc: Christian Brauner, Hugh Dickins, Andrew Morton, Al Viro,
Jan Kara, linux-fsdevel, linux-kernel, linux-mm
On Wed 05-07-23 15:00:36, Jeff Layton wrote:
> A rename potentially involves updating 4 different inode timestamps.
> Convert to the new simple_rename_timestamp helper function.
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
Looks good to me. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> mm/shmem.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/mm/shmem.c b/mm/shmem.c
> index 0f45e72a5ca7..1693134959c5 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -3306,9 +3306,7 @@ static int shmem_rename2(struct mnt_idmap *idmap,
>
> old_dir->i_size -= BOGO_DIRENT_SIZE;
> new_dir->i_size += BOGO_DIRENT_SIZE;
> - old_dir->i_ctime = old_dir->i_mtime =
> - new_dir->i_ctime = new_dir->i_mtime =
> - inode->i_ctime = current_time(old_dir);
> + simple_rename_timestamp(old_dir, old_dentry, new_dir, new_dentry);
> inode_inc_iversion(old_dir);
> inode_inc_iversion(new_dir);
> return 0;
> --
> 2.41.0
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 52/92] hugetlbfs: convert to ctime accessor functions
2023-07-05 19:01 ` [PATCH v2 52/92] hugetlbfs: " Jeff Layton
2023-07-05 19:58 ` Mike Kravetz
@ 2023-07-06 12:40 ` Jan Kara
1 sibling, 0 replies; 8+ messages in thread
From: Jan Kara @ 2023-07-06 12:40 UTC (permalink / raw)
To: Jeff Layton
Cc: Christian Brauner, Mike Kravetz, Muchun Song, Al Viro, Jan Kara,
linux-fsdevel, linux-kernel, linux-mm
On Wed 05-07-23 15:01:17, Jeff Layton wrote:
> In later patches, we're going to change how the inode's ctime field is
> used. Switch to using accessor functions instead of raw accesses of
> inode->i_ctime.
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
Looks good to me. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/hugetlbfs/inode.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
> index 7b17ccfa039d..93d3bcfd4fc8 100644
> --- a/fs/hugetlbfs/inode.c
> +++ b/fs/hugetlbfs/inode.c
> @@ -887,7 +887,7 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset,
>
> if (!(mode & FALLOC_FL_KEEP_SIZE) && offset + len > inode->i_size)
> i_size_write(inode, offset + len);
> - inode->i_ctime = current_time(inode);
> + inode_set_ctime_current(inode);
> out:
> inode_unlock(inode);
> return error;
> @@ -935,7 +935,7 @@ static struct inode *hugetlbfs_get_root(struct super_block *sb,
> inode->i_mode = S_IFDIR | ctx->mode;
> inode->i_uid = ctx->uid;
> inode->i_gid = ctx->gid;
> - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
> + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode);
> inode->i_op = &hugetlbfs_dir_inode_operations;
> inode->i_fop = &simple_dir_operations;
> /* directory inodes start off with i_nlink == 2 (for "." entry) */
> @@ -979,7 +979,7 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb,
> lockdep_set_class(&inode->i_mapping->i_mmap_rwsem,
> &hugetlbfs_i_mmap_rwsem_key);
> inode->i_mapping->a_ops = &hugetlbfs_aops;
> - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
> + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode);
> inode->i_mapping->private_data = resv_map;
> info->seals = F_SEAL_SEAL;
> switch (mode & S_IFMT) {
> @@ -1022,7 +1022,7 @@ static int hugetlbfs_mknod(struct mnt_idmap *idmap, struct inode *dir,
> inode = hugetlbfs_get_inode(dir->i_sb, dir, mode, dev);
> if (!inode)
> return -ENOSPC;
> - dir->i_ctime = dir->i_mtime = current_time(dir);
> + dir->i_mtime = inode_set_ctime_current(dir);
> d_instantiate(dentry, inode);
> dget(dentry);/* Extra count - pin the dentry in core */
> return 0;
> @@ -1054,7 +1054,7 @@ static int hugetlbfs_tmpfile(struct mnt_idmap *idmap,
> inode = hugetlbfs_get_inode(dir->i_sb, dir, mode | S_IFREG, 0);
> if (!inode)
> return -ENOSPC;
> - dir->i_ctime = dir->i_mtime = current_time(dir);
> + dir->i_mtime = inode_set_ctime_current(dir);
> d_tmpfile(file, inode);
> return finish_open_simple(file, 0);
> }
> @@ -1076,7 +1076,7 @@ static int hugetlbfs_symlink(struct mnt_idmap *idmap,
> } else
> iput(inode);
> }
> - dir->i_ctime = dir->i_mtime = current_time(dir);
> + dir->i_mtime = inode_set_ctime_current(dir);
>
> return error;
> }
> --
> 2.41.0
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 87/92] shmem: convert to ctime accessor functions
2023-07-05 19:01 ` [PATCH v2 87/92] shmem: " Jeff Layton
@ 2023-07-06 14:56 ` Jan Kara
0 siblings, 0 replies; 8+ messages in thread
From: Jan Kara @ 2023-07-06 14:56 UTC (permalink / raw)
To: Jeff Layton
Cc: Christian Brauner, Hugh Dickins, Andrew Morton, Al Viro,
Jan Kara, linux-fsdevel, linux-kernel, linux-mm
On Wed 05-07-23 15:01:52, Jeff Layton wrote:
> In later patches, we're going to change how the inode's ctime field is
> used. Switch to using accessor functions instead of raw accesses of
> inode->i_ctime.
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
Looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> mm/shmem.c | 22 ++++++++++++----------
> 1 file changed, 12 insertions(+), 10 deletions(-)
>
> diff --git a/mm/shmem.c b/mm/shmem.c
> index 1693134959c5..51aaaf479437 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -1064,7 +1064,7 @@ static void shmem_undo_range(struct inode *inode, loff_t lstart, loff_t lend,
> void shmem_truncate_range(struct inode *inode, loff_t lstart, loff_t lend)
> {
> shmem_undo_range(inode, lstart, lend, false);
> - inode->i_ctime = inode->i_mtime = current_time(inode);
> + inode->i_mtime = inode_set_ctime_current(inode);
> inode_inc_iversion(inode);
> }
> EXPORT_SYMBOL_GPL(shmem_truncate_range);
> @@ -1161,9 +1161,9 @@ static int shmem_setattr(struct mnt_idmap *idmap,
> if (attr->ia_valid & ATTR_MODE)
> error = posix_acl_chmod(idmap, dentry, inode->i_mode);
> if (!error && update_ctime) {
> - inode->i_ctime = current_time(inode);
> + inode_set_ctime_current(inode);
> if (update_mtime)
> - inode->i_mtime = inode->i_ctime;
> + inode->i_mtime = inode_get_ctime(inode);
> inode_inc_iversion(inode);
> }
> return error;
> @@ -2394,7 +2394,7 @@ static struct inode *shmem_get_inode(struct mnt_idmap *idmap, struct super_block
> inode->i_ino = ino;
> inode_init_owner(idmap, inode, dir, mode);
> inode->i_blocks = 0;
> - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
> + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode);
> inode->i_generation = get_random_u32();
> info = SHMEM_I(inode);
> memset(info, 0, (char *)inode - (char *)info);
> @@ -3110,7 +3110,7 @@ shmem_mknod(struct mnt_idmap *idmap, struct inode *dir,
> goto out_iput;
>
> dir->i_size += BOGO_DIRENT_SIZE;
> - dir->i_ctime = dir->i_mtime = current_time(dir);
> + dir->i_mtime = inode_set_ctime_current(dir);
> inode_inc_iversion(dir);
> d_instantiate(dentry, inode);
> dget(dentry); /* Extra count - pin the dentry in core */
> @@ -3193,7 +3193,8 @@ static int shmem_link(struct dentry *old_dentry, struct inode *dir, struct dentr
> }
>
> dir->i_size += BOGO_DIRENT_SIZE;
> - inode->i_ctime = dir->i_ctime = dir->i_mtime = current_time(inode);
> + dir->i_mtime = inode_set_ctime_to_ts(dir,
> + inode_set_ctime_current(inode));
> inode_inc_iversion(dir);
> inc_nlink(inode);
> ihold(inode); /* New dentry reference */
> @@ -3213,7 +3214,8 @@ static int shmem_unlink(struct inode *dir, struct dentry *dentry)
> simple_offset_remove(shmem_get_offset_ctx(dir), dentry);
>
> dir->i_size -= BOGO_DIRENT_SIZE;
> - inode->i_ctime = dir->i_ctime = dir->i_mtime = current_time(inode);
> + dir->i_mtime = inode_set_ctime_to_ts(dir,
> + inode_set_ctime_current(inode));
> inode_inc_iversion(dir);
> drop_nlink(inode);
> dput(dentry); /* Undo the count from "create" - this does all the work */
> @@ -3360,7 +3362,7 @@ static int shmem_symlink(struct mnt_idmap *idmap, struct inode *dir,
> folio_put(folio);
> }
> dir->i_size += BOGO_DIRENT_SIZE;
> - dir->i_ctime = dir->i_mtime = current_time(dir);
> + dir->i_mtime = inode_set_ctime_current(dir);
> inode_inc_iversion(dir);
> d_instantiate(dentry, inode);
> dget(dentry);
> @@ -3438,7 +3440,7 @@ static int shmem_fileattr_set(struct mnt_idmap *idmap,
> (fa->flags & SHMEM_FL_USER_MODIFIABLE);
>
> shmem_set_inode_flags(inode, info->fsflags);
> - inode->i_ctime = current_time(inode);
> + inode_set_ctime_current(inode);
> inode_inc_iversion(inode);
> return 0;
> }
> @@ -3508,7 +3510,7 @@ static int shmem_xattr_handler_set(const struct xattr_handler *handler,
> name = xattr_full_name(handler, name);
> err = simple_xattr_set(&info->xattrs, name, value, size, flags, NULL);
> if (!err) {
> - inode->i_ctime = current_time(inode);
> + inode_set_ctime_current(inode);
> inode_inc_iversion(inode);
> }
> return err;
> --
> 2.41.0
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-07-06 14:56 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20230705185755.579053-1-jlayton@kernel.org>
[not found] ` <20230705190309.579783-1-jlayton@kernel.org>
2023-07-05 19:00 ` [PATCH v2 11/92] shmem: convert to simple_rename_timestamp Jeff Layton
2023-07-06 10:33 ` Jan Kara
2023-07-05 19:00 ` [PATCH v2 25/92] fs: convert to ctime accessor functions Jeff Layton
2023-07-05 19:01 ` [PATCH v2 52/92] hugetlbfs: " Jeff Layton
2023-07-05 19:58 ` Mike Kravetz
2023-07-06 12:40 ` Jan Kara
2023-07-05 19:01 ` [PATCH v2 87/92] shmem: " Jeff Layton
2023-07-06 14:56 ` Jan Kara
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox