From: Jan Kara <jack@suse.cz>
To: Jeff Layton <jlayton@kernel.org>
Cc: Christian Brauner <brauner@kernel.org>,
Hugh Dickins <hughd@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Al Viro <viro@zeniv.linux.org.uk>, Jan Kara <jack@suse.cz>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org
Subject: Re: [PATCH v2 87/92] shmem: convert to ctime accessor functions
Date: Thu, 6 Jul 2023 16:56:23 +0200 [thread overview]
Message-ID: <20230706145623.jkgc7awfs4xhioqy@quack3> (raw)
In-Reply-To: <20230705190309.579783-85-jlayton@kernel.org>
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
prev parent reply other threads:[~2023-07-06 14:56 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[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 message]
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=20230706145623.jkgc7awfs4xhioqy@quack3 \
--to=jack@suse.cz \
--cc=akpm@linux-foundation.org \
--cc=brauner@kernel.org \
--cc=hughd@google.com \
--cc=jlayton@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--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