From: Jeff Layton <jlayton@kernel.org>
To: Christian Brauner <brauner@kernel.org>,
Hugh Dickins <hughd@google.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>, Jan Kara <jack@suse.cz>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: [PATCH 74/79] shmem: switch to new ctime accessors
Date: Wed, 21 Jun 2023 10:46:27 -0400 [thread overview]
Message-ID: <20230621144735.55953-73-jlayton@kernel.org> (raw)
In-Reply-To: <20230621144735.55953-1-jlayton@kernel.org>
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>
---
mm/shmem.c | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/mm/shmem.c b/mm/shmem.c
index 4752084720b2..4979cb3e37e5 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_ctime_set_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_ctime_set_current(inode);
if (update_mtime)
- inode->i_mtime = inode->i_ctime;
+ inode->i_mtime = inode_ctime_peek(inode);
inode_inc_iversion(inode);
}
return error;
@@ -2389,7 +2389,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_ctime_set_current(inode);
inode->i_generation = get_random_u32();
info = SHMEM_I(inode);
memset(info, 0, (char *)inode - (char *)info);
@@ -3101,7 +3101,7 @@ shmem_mknod(struct mnt_idmap *idmap, struct inode *dir,
error = 0;
dir->i_size += BOGO_DIRENT_SIZE;
- dir->i_ctime = dir->i_mtime = current_time(dir);
+ dir->i_mtime = inode_ctime_set_current(dir);
inode_inc_iversion(dir);
d_instantiate(dentry, inode);
dget(dentry); /* Extra count - pin the dentry in core */
@@ -3177,7 +3177,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_ctime_set_current(inode);
+ inode_ctime_set(dir, dir->i_mtime);
inode_inc_iversion(dir);
inc_nlink(inode);
ihold(inode); /* New dentry reference */
@@ -3195,7 +3196,8 @@ static int shmem_unlink(struct inode *dir, struct dentry *dentry)
shmem_free_inode(inode->i_sb);
dir->i_size -= BOGO_DIRENT_SIZE;
- inode->i_ctime = dir->i_ctime = dir->i_mtime = current_time(inode);
+ dir->i_mtime = inode_ctime_set_current(inode);
+ inode_ctime_set(dir, dir->i_mtime);
inode_inc_iversion(dir);
drop_nlink(inode);
dput(dentry); /* Undo the count from "create" - this does all the work */
@@ -3283,9 +3285,9 @@ 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);
+ 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);
inode_inc_iversion(old_dir);
inode_inc_iversion(new_dir);
return 0;
@@ -3339,7 +3341,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_ctime_set_current(dir);
inode_inc_iversion(dir);
d_instantiate(dentry, inode);
dget(dentry);
@@ -3411,7 +3413,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_ctime_set_current(inode);
inode_inc_iversion(inode);
return 0;
}
@@ -3481,7 +3483,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_ctime_set_current(inode);
inode_inc_iversion(inode);
}
return err;
--
2.41.0
next prev parent reply other threads:[~2023-06-21 14:49 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20230621144507.55591-1-jlayton@kernel.org>
[not found] ` <20230621144735.55953-1-jlayton@kernel.org>
2023-06-21 14:45 ` [PATCH 12/79] fs: " Jeff Layton
2023-06-21 16:42 ` Jan Kara
2023-06-21 14:45 ` [PATCH 39/79] hugetlbfs: " Jeff Layton
2023-06-21 14:46 ` Jeff Layton [this message]
2023-06-21 19:21 ` [PATCH 00/79] fs: new accessors for inode->i_ctime Steven Rostedt
2023-06-21 19:52 ` Jeff Layton
2023-06-23 12:41 ` Christian Brauner
2023-06-30 22:11 ` Luis Chamberlain
[not found] ` <20230621144507.55591-2-jlayton@kernel.org>
2023-06-21 17:29 ` [PATCH 01/79] fs: add ctime accessors infrastructure Tom Talpey
2023-06-21 18:01 ` Jeff Layton
2023-06-21 18:19 ` Tom Talpey
2023-06-21 18:48 ` Jeff Layton
2023-06-22 0:46 ` Damien Le Moal
2023-06-22 10:14 ` Jeff Layton
2023-06-30 22:12 ` Luis Chamberlain
2023-07-12 15:31 ` Randy Dunlap
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230621144735.55953-73-jlayton@kernel.org \
--to=jlayton@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=brauner@kernel.org \
--cc=hughd@google.com \
--cc=jack@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox