public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: Christian Brauner <brauner@kernel.org>,
	Anton Altaparmakov <anton@tuxera.com>,
	Namjae Jeon <linkinjeon@kernel.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>, Jan Kara <jack@suse.cz>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-ntfs-dev@lists.sourceforge.net
Subject: [PATCH v2 60/92] ntfs: convert to ctime accessor functions
Date: Wed,  5 Jul 2023 15:01:25 -0400	[thread overview]
Message-ID: <20230705190309.579783-58-jlayton@kernel.org> (raw)
In-Reply-To: <20230705190309.579783-1-jlayton@kernel.org>

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/ntfs/inode.c | 15 ++++++++-------
 fs/ntfs/mft.c   |  3 +--
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c
index 6c3f38d66579..99ac6ea277c4 100644
--- a/fs/ntfs/inode.c
+++ b/fs/ntfs/inode.c
@@ -654,7 +654,7 @@ static int ntfs_read_locked_inode(struct inode *vi)
 	 * always changes, when mtime is changed. ctime can be changed on its
 	 * own, mtime is then not changed, e.g. when a file is renamed.
 	 */
-	vi->i_ctime = ntfs2utc(si->last_mft_change_time);
+	inode_set_ctime_to_ts(vi, ntfs2utc(si->last_mft_change_time));
 	/*
 	 * Last access to the data within the file. Not changed during a rename
 	 * for example but changed whenever the file is written to.
@@ -1218,7 +1218,7 @@ static int ntfs_read_locked_attr_inode(struct inode *base_vi, struct inode *vi)
 	vi->i_gid	= base_vi->i_gid;
 	set_nlink(vi, base_vi->i_nlink);
 	vi->i_mtime	= base_vi->i_mtime;
-	vi->i_ctime	= base_vi->i_ctime;
+	inode_set_ctime_to_ts(vi, inode_get_ctime(base_vi));
 	vi->i_atime	= base_vi->i_atime;
 	vi->i_generation = ni->seq_no = base_ni->seq_no;
 
@@ -1484,7 +1484,7 @@ static int ntfs_read_locked_index_inode(struct inode *base_vi, struct inode *vi)
 	vi->i_gid	= base_vi->i_gid;
 	set_nlink(vi, base_vi->i_nlink);
 	vi->i_mtime	= base_vi->i_mtime;
-	vi->i_ctime	= base_vi->i_ctime;
+	inode_set_ctime_to_ts(vi, inode_get_ctime(base_vi));
 	vi->i_atime	= base_vi->i_atime;
 	vi->i_generation = ni->seq_no = base_ni->seq_no;
 	/* Set inode type to zero but preserve permissions. */
@@ -2804,13 +2804,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));
 		int sync_it = 0;
 
 		if (!timespec64_equal(&VFS_I(base_ni)->i_mtime, &now) ||
-		    !timespec64_equal(&VFS_I(base_ni)->i_ctime, &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;
-		VFS_I(base_ni)->i_ctime = now;
 
 		if (sync_it)
 			mark_inode_dirty_sync(VFS_I(base_ni));
@@ -2928,7 +2929,7 @@ int ntfs_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
 	if (ia_valid & ATTR_MTIME)
 		vi->i_mtime = attr->ia_mtime;
 	if (ia_valid & ATTR_CTIME)
-		vi->i_ctime = attr->ia_ctime;
+		inode_set_ctime_to_ts(vi, attr->ia_ctime);
 	mark_inode_dirty(vi);
 out:
 	return err;
@@ -3004,7 +3005,7 @@ int __ntfs_write_inode(struct inode *vi, int sync)
 		si->last_data_change_time = nt;
 		modified = true;
 	}
-	nt = utc2ntfs(vi->i_ctime);
+	nt = utc2ntfs(inode_get_ctime(vi));
 	if (si->last_mft_change_time != nt) {
 		ntfs_debug("Updating ctime for inode 0x%lx: old = 0x%llx, "
 				"new = 0x%llx", vi->i_ino, (long long)
diff --git a/fs/ntfs/mft.c b/fs/ntfs/mft.c
index 0155f106ec34..ad1a8f72da22 100644
--- a/fs/ntfs/mft.c
+++ b/fs/ntfs/mft.c
@@ -2682,8 +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 = vi->i_ctime =
-			current_time(vi);
+		vi->i_atime = vi->i_mtime = inode_set_ctime_current(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


  parent reply	other threads:[~2023-07-05 19:08 UTC|newest]

Thread overview: 185+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230705185755.579053-1-jlayton@kernel.org>
2023-07-05 19:00 ` [PATCH v2 01/92] ibmvmc: update ctime in conjunction with mtime on write Jeff Layton
2023-07-05 19:00   ` [PATCH v2 02/92] bfs: update ctime in addition to mtime when adding entries Jeff Layton
2023-07-05 19:00   ` [PATCH v2 03/92] efivarfs: update ctime when mtime changes on a write Jeff Layton
2023-07-05 19:00   ` [PATCH v2 04/92] exfat: ensure that ctime is updated whenever the mtime is Jeff Layton
2023-07-05 19:00   ` [PATCH v2 05/92] apparmor: update ctime whenever the mtime changes on an inode Jeff Layton
2023-07-05 19:00   ` [PATCH v2 06/92] cifs: update the ctime on a partial page write Jeff Layton
     [not found]     ` <CAH2r5mv+Fc9PuNtb8qMTwpb8qrEO2Tta5+o=mxD-2AY0cU5Aeg@mail.gmail.com>
2023-07-06  7:11       ` Christian Brauner
2023-07-06 15:26     ` Steve French
2023-07-05 19:00   ` [PATCH v2 09/92] btrfs: convert to simple_rename_timestamp Jeff Layton
2023-07-05 19:00   ` [PATCH v2 10/92] ubifs: " Jeff Layton
2023-07-06 10:30     ` Jan Kara
2023-07-06 12:08     ` Zhihao Cheng
2023-07-05 19:00   ` [PATCH v2 11/92] shmem: " Jeff Layton
2023-07-06 10:33     ` Jan Kara
2023-07-05 19:00   ` [PATCH v2 12/92] exfat: " Jeff Layton
2023-07-06 10:39     ` Jan Kara
2023-07-06 11:40       ` Jeff Layton
2023-07-05 19:00   ` [PATCH v2 13/92] ntfs3: " Jeff Layton
2023-07-06 10:40     ` Jan Kara
2023-07-05 19:00   ` [PATCH v2 14/92] reiserfs: " Jeff Layton
2023-07-06 10:32     ` Jan Kara
2023-07-05 19:00   ` [PATCH v2 15/92] spufs: convert to ctime accessor functions Jeff Layton
2023-07-06 11:34     ` Arnd Bergmann
2023-07-05 19:00   ` [PATCH v2 16/92] s390: " Jeff Layton
2023-07-12 12:56     ` Alexander Gordeev
2023-07-05 19:00   ` [PATCH v2 17/92] binderfs: " Jeff Layton
2023-07-05 19:00   ` [PATCH v2 18/92] infiniband: " Jeff Layton
2023-07-05 19:00   ` [PATCH v2 19/92] ibm: " Jeff Layton
2023-07-06 10:41     ` Jan Kara
2023-07-05 19:00   ` [PATCH v2 20/92] usb: " Jeff Layton
2023-07-05 19:00   ` [PATCH v2 21/92] 9p: " Jeff Layton
2023-07-05 19:00   ` [PATCH v2 22/92] adfs: " Jeff Layton
2023-07-05 19:00   ` [PATCH v2 23/92] affs: " Jeff Layton
2023-07-05 19:00   ` [PATCH v2 24/92] afs: " Jeff Layton
2023-07-05 19:00   ` [PATCH v2 25/92] fs: " Jeff Layton
2023-07-05 19:00   ` [PATCH v2 26/92] autofs: " Jeff Layton
2023-07-05 19:00   ` [PATCH v2 27/92] befs: " Jeff Layton
2023-07-05 19:00   ` [PATCH v2 28/92] bfs: " Jeff Layton
2023-07-06 10:44     ` Jan Kara
2023-07-05 19:00   ` [PATCH v2 29/92] btrfs: " Jeff Layton
2023-07-06 10:51     ` Jan Kara
2023-07-05 19:00   ` [PATCH v2 30/92] ceph: " Jeff Layton
2023-07-06 10:53     ` Jan Kara
2023-07-06 11:47       ` Jeff Layton
2023-07-05 19:00   ` [PATCH v2 31/92] coda: " Jeff Layton
2023-07-06 10:54     ` Jan Kara
2023-07-05 19:00   ` [PATCH v2 32/92] configfs: " Jeff Layton
2023-07-06 10:54     ` Jan Kara
2023-07-06 22:12       ` Joel Becker
2023-07-05 19:00   ` [PATCH v2 33/92] cramfs: " Jeff Layton
2023-07-06 10:55     ` Jan Kara
2023-07-05 19:00   ` [PATCH v2 34/92] debugfs: " Jeff Layton
2023-07-06 10:55     ` Jan Kara
2023-07-05 19:01   ` [PATCH v2 35/92] devpts: " Jeff Layton
2023-07-06 10:56     ` Jan Kara
2023-07-05 19:01   ` [PATCH v2 36/92] ecryptfs: " Jeff Layton
2023-07-06 10:56     ` Jan Kara
2023-07-05 19:01   ` [PATCH v2 37/92] efivarfs: " Jeff Layton
2023-07-06 10:57     ` Jan Kara
2023-07-05 19:01   ` [PATCH v2 38/92] efs: " Jeff Layton
2023-07-06 10:57     ` Jan Kara
2023-07-05 19:01   ` [PATCH v2 39/92] erofs: " Jeff Layton
2023-07-06 11:00     ` Jan Kara
2023-07-06 11:53       ` Jeff Layton
2023-07-06 15:12       ` Gao Xiang
2023-07-05 19:01   ` [PATCH v2 40/92] exfat: " Jeff Layton
2023-07-06 11:01     ` Jan Kara
2023-07-05 19:01   ` [PATCH v2 41/92] ext2: " Jeff Layton
2023-07-06 11:03     ` Jan Kara
2023-07-05 19:01   ` [PATCH v2 42/92] ext4: " Jeff Layton
2023-07-06 12:36     ` Jan Kara
2023-07-06 13:10       ` Jeff Layton
2023-07-05 19:01   ` [PATCH v2 43/92] f2fs: " Jeff Layton
2023-07-06 11:18     ` Jan Kara
2023-09-04 18:11     ` [f2fs-dev] " patchwork-bot+f2fs
2023-07-05 19:01   ` [PATCH v2 44/92] fat: " Jeff Layton
2023-07-06  1:54     ` OGAWA Hirofumi
2023-07-06 11:25       ` Jeff Layton
2023-07-05 19:01   ` [PATCH v2 45/92] freevxfs: " Jeff Layton
2023-07-06 11:19     ` Jan Kara
2023-07-05 19:01   ` [PATCH v2 46/92] fuse: " Jeff Layton
2023-07-06 11:20     ` Jan Kara
2023-07-05 19:01   ` [PATCH v2 47/92] gfs2: " Jeff Layton
2023-07-06 12:54     ` Jan Kara
2023-07-05 19:01   ` [PATCH v2 48/92] hfs: " Jeff Layton
2023-07-06 12:50     ` Jan Kara
2023-07-05 19:01   ` [PATCH v2 49/92] hfsplus: " Jeff Layton
2023-07-06 12:49     ` Jan Kara
2023-07-05 19:01   ` [PATCH v2 50/92] hostfs: " Jeff Layton
2023-07-06 12:48     ` Jan Kara
2023-07-05 19:01   ` [PATCH v2 51/92] hpfs: " Jeff Layton
2023-07-06 12:47     ` Jan Kara
2023-07-06 13:11       ` 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 53/92] isofs: " Jeff Layton
2023-07-06 12:39     ` Jan Kara
2023-07-06 13:11       ` Jeff Layton
2023-07-05 19:01   ` [PATCH v2 54/92] jffs2: " Jeff Layton
2023-07-06 13:25     ` Jan Kara
2023-07-05 19:01   ` [PATCH v2 55/92] jfs: " Jeff Layton
2023-07-06 13:27     ` Jan Kara
2023-07-05 19:01   ` [PATCH v2 56/92] kernfs: " Jeff Layton
2023-07-06 13:32     ` Jan Kara
2023-07-06 13:50       ` Jeff Layton
2023-07-05 19:01   ` [PATCH v2 57/92] nfs: " Jeff Layton
2023-07-06 13:34     ` Jan Kara
2023-07-05 19:01   ` [PATCH v2 58/92] nfsd: " Jeff Layton
2023-07-06 13:34     ` Jan Kara
2023-07-05 19:01   ` [PATCH v2 59/92] nilfs2: " Jeff Layton
2023-07-06 13:35     ` Jan Kara
2023-07-05 19:01   ` Jeff Layton [this message]
2023-07-06 13:37     ` [PATCH v2 60/92] ntfs: " Jan Kara
2023-07-05 19:01   ` [PATCH v2 61/92] ntfs3: " Jeff Layton
2023-07-06 13:47     ` Jan Kara
2023-07-05 19:01   ` [PATCH v2 62/92] ocfs2: " Jeff Layton
2023-07-06 13:51     ` Jan Kara
2023-07-07  3:15     ` Joseph Qi
2023-07-07 10:07       ` Jeff Layton
2023-07-09 13:59         ` Joseph Qi
2023-07-05 19:01   ` [PATCH v2 63/92] omfs: " Jeff Layton
2023-07-06 13:52     ` Jan Kara
2023-07-05 19:01   ` [PATCH v2 64/92] openpromfs: " Jeff Layton
2023-07-06 13:52     ` Jan Kara
2023-07-05 19:01   ` [PATCH v2 65/92] orangefs: " Jeff Layton
2023-07-06 13:55     ` Jan Kara
2023-07-06 13:56     ` Jan Kara
2023-07-05 19:01   ` [PATCH v2 66/92] overlayfs: " Jeff Layton
2023-07-06 13:58     ` Jan Kara
2023-07-06 14:01       ` Jeff Layton
2023-07-05 19:01   ` [PATCH v2 67/92] procfs: " Jeff Layton
2023-07-06 13:59     ` Jan Kara
2023-07-05 19:01   ` [PATCH v2 68/92] pstore: " Jeff Layton
2023-07-06 14:00     ` Jan Kara
2023-07-05 19:01   ` [PATCH v2 69/92] qnx4: " Jeff Layton
2023-07-06 14:00     ` Jan Kara
2023-07-05 19:01   ` [PATCH v2 70/92] qnx6: " Jeff Layton
2023-07-06 14:01     ` Jan Kara
2023-07-05 19:01   ` [PATCH v2 71/92] ramfs: " Jeff Layton
2023-07-06 14:01     ` Jan Kara
2023-07-05 19:01   ` [PATCH v2 72/92] reiserfs: " Jeff Layton
2023-07-06 14:03     ` Jan Kara
2023-07-05 19:01   ` [PATCH v2 73/92] romfs: " Jeff Layton
2023-07-06 14:04     ` Jan Kara
2023-07-05 19:01   ` [PATCH v2 74/92] smb: " Jeff Layton
2023-07-05 23:01     ` Jeff Layton
2023-07-06 15:28     ` Steve French
2023-07-05 19:01   ` [PATCH v2 75/92] squashfs: " Jeff Layton
2023-07-06 14:04     ` Jan Kara
2023-07-05 19:01   ` [PATCH v2 76/92] sysv: " Jeff Layton
2023-07-06 14:05     ` Jan Kara
2023-07-05 19:01   ` [PATCH v2 77/92] tracefs: " Jeff Layton
2023-07-06 14:06     ` Jan Kara
2023-07-06 14:27     ` Steven Rostedt
2023-07-05 19:01   ` [PATCH v2 78/92] ubifs: " Jeff Layton
2023-07-06 12:07     ` Zhihao Cheng
2023-07-06 12:10       ` Jeff Layton
2023-07-05 19:01   ` [PATCH v2 79/92] udf: " Jeff Layton
2023-07-06 12:57     ` Jan Kara
2023-07-05 19:01   ` [PATCH v2 80/92] ufs: " Jeff Layton
2023-07-06 14:49     ` Jan Kara
2023-07-05 19:01   ` [PATCH v2 81/92] vboxsf: " Jeff Layton
2023-07-06 14:50     ` Jan Kara
2023-07-05 19:01   ` [PATCH v2 82/92] xfs: " Jeff Layton
2023-07-06 14:52     ` Jan Kara
2023-07-05 19:01   ` [PATCH v2 83/92] zonefs: " Jeff Layton
2023-07-06 14:52     ` Jan Kara
2023-07-05 19:01   ` [PATCH v2 84/92] linux: " Jeff Layton
2023-07-06 14:53     ` Jan Kara
2023-07-06 15:05       ` Jeff Layton
2023-07-05 19:01   ` [PATCH v2 85/92] mqueue: " Jeff Layton
2023-07-06 14:54     ` Jan Kara
2023-07-05 19:01   ` [PATCH v2 86/92] bpf: " Jeff Layton
2023-07-06 14:55     ` Jan Kara
2023-07-05 19:01   ` [PATCH v2 87/92] shmem: " Jeff Layton
2023-07-06 14:56     ` Jan Kara
2023-07-05 19:01   ` [PATCH v2 88/92] sunrpc: " Jeff Layton
2023-07-06 14:56     ` Jan Kara
2023-07-05 19:01   ` [PATCH v2 89/92] apparmor: " Jeff Layton
2023-07-06 14:57     ` Jan Kara
2023-07-05 19:01   ` [PATCH v2 90/92] security: " Jeff Layton
2023-07-06 14:57     ` Jan Kara
2023-07-05 19:01   ` [PATCH v2 91/92] selinux: " Jeff Layton
2023-07-06 14:57     ` Jan Kara

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=20230705190309.579783-58-jlayton@kernel.org \
    --to=jlayton@kernel.org \
    --cc=anton@tuxera.com \
    --cc=brauner@kernel.org \
    --cc=jack@suse.cz \
    --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