From: Jeff Layton <jlayton@kernel.org>
To: Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Namjae Jeon <linkinjeon@kernel.org>,
linux-ntfs-dev@lists.sourceforge.net
Subject: [PATCH v2 54/89] ntfs: convert to new timestamp accessors
Date: Wed, 4 Oct 2023 14:52:39 -0400 [thread overview]
Message-ID: <20231004185347.80880-52-jlayton@kernel.org> (raw)
In-Reply-To: <20231004185347.80880-1-jlayton@kernel.org>
Convert to using the new inode timestamp accessor functions.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/ntfs/inode.c | 25 +++++++++++++------------
fs/ntfs/mft.c | 2 +-
2 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c
index 99ac6ea277c4..aba1e22db4e9 100644
--- a/fs/ntfs/inode.c
+++ b/fs/ntfs/inode.c
@@ -648,7 +648,7 @@ static int ntfs_read_locked_inode(struct inode *vi)
* mtime is the last change of the data within the file. Not changed
* when only metadata is changed, e.g. a rename doesn't affect mtime.
*/
- vi->i_mtime = ntfs2utc(si->last_data_change_time);
+ inode_set_mtime_to_ts(vi, ntfs2utc(si->last_data_change_time));
/*
* ctime is the last change of the metadata of the file. This obviously
* always changes, when mtime is changed. ctime can be changed on its
@@ -659,7 +659,7 @@ static int ntfs_read_locked_inode(struct inode *vi)
* Last access to the data within the file. Not changed during a rename
* for example but changed whenever the file is written to.
*/
- vi->i_atime = ntfs2utc(si->last_access_time);
+ inode_set_atime_to_ts(vi, ntfs2utc(si->last_access_time));
/* Find the attribute list attribute if present. */
ntfs_attr_reinit_search_ctx(ctx);
@@ -1217,9 +1217,9 @@ static int ntfs_read_locked_attr_inode(struct inode *base_vi, struct inode *vi)
vi->i_uid = base_vi->i_uid;
vi->i_gid = base_vi->i_gid;
set_nlink(vi, base_vi->i_nlink);
- vi->i_mtime = base_vi->i_mtime;
+ inode_set_mtime_to_ts(vi, inode_get_mtime(base_vi));
inode_set_ctime_to_ts(vi, inode_get_ctime(base_vi));
- vi->i_atime = base_vi->i_atime;
+ inode_set_atime_to_ts(vi, inode_get_atime(base_vi));
vi->i_generation = ni->seq_no = base_ni->seq_no;
/* Set inode type to zero but preserve permissions. */
@@ -1483,9 +1483,9 @@ static int ntfs_read_locked_index_inode(struct inode *base_vi, struct inode *vi)
vi->i_uid = base_vi->i_uid;
vi->i_gid = base_vi->i_gid;
set_nlink(vi, base_vi->i_nlink);
- vi->i_mtime = base_vi->i_mtime;
+ inode_set_mtime_to_ts(vi, inode_get_mtime(base_vi));
inode_set_ctime_to_ts(vi, inode_get_ctime(base_vi));
- vi->i_atime = base_vi->i_atime;
+ inode_set_atime_to_ts(vi, inode_get_atime(base_vi));
vi->i_generation = ni->seq_no = base_ni->seq_no;
/* Set inode type to zero but preserve permissions. */
vi->i_mode = base_vi->i_mode & ~S_IFMT;
@@ -2805,13 +2805,14 @@ int ntfs_truncate(struct inode *vi)
if (!IS_NOCMTIME(VFS_I(base_ni)) && !IS_RDONLY(VFS_I(base_ni))) {
struct timespec64 now = current_time(VFS_I(base_ni));
struct timespec64 ctime = inode_get_ctime(VFS_I(base_ni));
+ struct timespec64 mtime = inode_get_mtime(VFS_I(base_ni));
int sync_it = 0;
- if (!timespec64_equal(&VFS_I(base_ni)->i_mtime, &now) ||
+ if (!timespec64_equal(&mtime, &now) ||
!timespec64_equal(&ctime, &now))
sync_it = 1;
inode_set_ctime_to_ts(VFS_I(base_ni), now);
- VFS_I(base_ni)->i_mtime = now;
+ inode_set_mtime_to_ts(VFS_I(base_ni), now);
if (sync_it)
mark_inode_dirty_sync(VFS_I(base_ni));
@@ -2925,9 +2926,9 @@ int ntfs_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
}
}
if (ia_valid & ATTR_ATIME)
- vi->i_atime = attr->ia_atime;
+ inode_set_atime_to_ts(vi, attr->ia_atime);
if (ia_valid & ATTR_MTIME)
- vi->i_mtime = attr->ia_mtime;
+ inode_set_mtime_to_ts(vi, attr->ia_mtime);
if (ia_valid & ATTR_CTIME)
inode_set_ctime_to_ts(vi, attr->ia_ctime);
mark_inode_dirty(vi);
@@ -2996,7 +2997,7 @@ int __ntfs_write_inode(struct inode *vi, int sync)
si = (STANDARD_INFORMATION*)((u8*)ctx->attr +
le16_to_cpu(ctx->attr->data.resident.value_offset));
/* Update the access times if they have changed. */
- nt = utc2ntfs(vi->i_mtime);
+ nt = utc2ntfs(inode_get_mtime(vi));
if (si->last_data_change_time != nt) {
ntfs_debug("Updating mtime for inode 0x%lx: old = 0x%llx, "
"new = 0x%llx", vi->i_ino, (long long)
@@ -3014,7 +3015,7 @@ int __ntfs_write_inode(struct inode *vi, int sync)
si->last_mft_change_time = nt;
modified = true;
}
- nt = utc2ntfs(vi->i_atime);
+ nt = utc2ntfs(inode_get_atime(vi));
if (si->last_access_time != nt) {
ntfs_debug("Updating atime for inode 0x%lx: old = 0x%llx, "
"new = 0x%llx", vi->i_ino,
diff --git a/fs/ntfs/mft.c b/fs/ntfs/mft.c
index ad1a8f72da22..6fd1dc4b08c8 100644
--- a/fs/ntfs/mft.c
+++ b/fs/ntfs/mft.c
@@ -2682,7 +2682,7 @@ ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, const int mode,
vi->i_mode &= ~S_IWUGO;
/* Set the inode times to the current time. */
- vi->i_atime = vi->i_mtime = inode_set_ctime_current(vi);
+ simple_inode_init_ts(vi);
/*
* Set the file size to 0, the ntfs inode sizes are set to 0 by
* the call to ntfs_init_big_inode() below.
--
2.41.0
next prev parent reply other threads:[~2023-10-04 18:57 UTC|newest]
Thread overview: 92+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-04 18:52 [PATCH v2 00/89] fs: new accessor methods for inode atime and mtime Jeff Layton
2023-10-04 18:51 ` [PATCH v2 03/89] spufs: convert to new timestamp accessors Jeff Layton
2023-10-04 18:51 ` [PATCH v2 04/89] hypfs: " Jeff Layton
2023-10-04 18:51 ` [PATCH v2 05/89] android: " Jeff Layton
2023-10-04 18:51 ` [PATCH v2 06/89] char: " Jeff Layton
2023-10-04 18:51 ` [PATCH v2 07/89] qib: " Jeff Layton
2023-10-04 18:51 ` [PATCH v2 08/89] ibmasm: " Jeff Layton
2023-10-04 18:51 ` [PATCH v2 09/89] misc: " Jeff Layton
2023-10-04 18:51 ` [PATCH v2 10/89] x86: " Jeff Layton
2023-10-04 18:51 ` [PATCH v2 11/89] tty: " Jeff Layton
2023-10-04 18:51 ` [PATCH v2 12/89] function: " Jeff Layton
2023-10-04 18:51 ` [PATCH v2 13/89] legacy: " Jeff Layton
2023-10-04 18:51 ` [PATCH v2 14/89] usb: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 15/89] 9p: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 16/89] adfs: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 17/89] affs: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 18/89] afs: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 19/89] autofs: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 20/89] bcachefs: " Jeff Layton
2023-10-05 12:08 ` Brian Foster
2023-10-04 18:52 ` [PATCH v2 21/89] befs: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 22/89] bfs: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 23/89] btrfs: " Jeff Layton
2023-10-09 16:53 ` David Sterba
2023-10-04 18:52 ` [PATCH v2 24/89] ceph: " Jeff Layton
2023-10-07 1:25 ` Xiubo Li
2023-10-04 18:52 ` [PATCH v2 25/89] coda: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 26/89] configfs: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 27/89] cramfs: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 28/89] debugfs: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 29/89] devpts: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 30/89] efivarfs: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 31/89] efs: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 32/89] erofs: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 33/89] exfat: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 34/89] ext2: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 35/89] ext4: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 36/89] f2fs: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 37/89] fat: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 38/89] freevxfs: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 39/89] fuse: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 40/89] gfs2: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 41/89] hfs: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 42/89] hfsplus: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 43/89] hostfs: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 44/89] hpfs: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 45/89] hugetlbfs: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 46/89] isofs: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 47/89] jffs2: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 48/89] jfs: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 49/89] kernfs: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 50/89] minix: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 51/89] nfs: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 52/89] nfsd: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 53/89] nilfs2: " Jeff Layton
2023-10-04 18:52 ` Jeff Layton [this message]
2023-10-04 18:52 ` [PATCH v2 55/89] ntfs3: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 56/89] ocfs2: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 57/89] omfs: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 58/89] openpromfs: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 59/89] orangefs: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 60/89] overlayfs: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 61/89] proc: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 62/89] pstore: " Jeff Layton
2023-10-04 19:07 ` Kees Cook
2023-10-04 18:52 ` [PATCH v2 63/89] qnx4: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 64/89] qnx6: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 65/89] ramfs: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 66/89] reiserfs: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 67/89] romfs: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 68/89] client: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 69/89] server: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 70/89] squashfs: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 71/89] sysv: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 72/89] tracefs: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 73/89] ubifs: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 74/89] udf: " Jeff Layton
2023-10-04 18:53 ` [PATCH v2 75/89] ufs: " Jeff Layton
2023-10-04 18:53 ` [PATCH v2 76/89] vboxsf: " Jeff Layton
2023-10-04 18:53 ` [PATCH v2 77/89] xfs: " Jeff Layton
2023-10-04 18:53 ` [PATCH v2 78/89] zonefs: " Jeff Layton
2023-10-04 18:53 ` [PATCH v2 79/89] linux: " Jeff Layton
2023-10-04 18:53 ` [PATCH v2 80/89] ipc: " Jeff Layton
2023-10-04 18:53 ` [PATCH v2 81/89] bpf: " Jeff Layton
2023-10-04 18:53 ` [PATCH v2 82/89] mm: " Jeff Layton
2023-10-04 18:53 ` [PATCH v2 83/89] sunrpc: " Jeff Layton
2023-10-04 18:53 ` [PATCH v2 84/89] apparmor: " Jeff Layton
2023-10-04 18:53 ` [PATCH v2 85/89] selinux: " Jeff Layton
2023-10-04 18:53 ` [PATCH v2 86/89] security: " Jeff Layton
2023-10-04 18:52 ` [PATCH v2 01/89] fs: new accessor methods for atime and mtime Jeff Layton
2023-10-04 18:52 ` [PATCH v2 02/89] fs: convert core infrastructure to new timestamp accessors Jeff Layton
2023-10-09 16:09 ` [PATCH v2 00/89] fs: new accessor methods for inode atime and mtime Christian Brauner
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=20231004185347.80880-52-jlayton@kernel.org \
--to=jlayton@kernel.org \
--cc=brauner@kernel.org \
--cc=linkinjeon@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-ntfs-dev@lists.sourceforge.net \
--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;
as well as URLs for NNTP newsgroup(s).