linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: Christian Brauner <brauner@kernel.org>, David Sterba <dsterba@suse.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>, Jan Kara <jack@suse.cz>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 10/79] affs: switch to new ctime accessors
Date: Wed, 21 Jun 2023 10:45:23 -0400	[thread overview]
Message-ID: <20230621144735.55953-9-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>
---
 fs/affs/amigaffs.c |  6 +++---
 fs/affs/inode.c    | 17 +++++++++--------
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/fs/affs/amigaffs.c b/fs/affs/amigaffs.c
index 29f11e10a7c7..2b508aa6707e 100644
--- a/fs/affs/amigaffs.c
+++ b/fs/affs/amigaffs.c
@@ -60,7 +60,7 @@ affs_insert_hash(struct inode *dir, struct buffer_head *bh)
 	mark_buffer_dirty_inode(dir_bh, dir);
 	affs_brelse(dir_bh);
 
-	dir->i_mtime = dir->i_ctime = current_time(dir);
+	dir->i_mtime = inode_ctime_set_current(dir);
 	inode_inc_iversion(dir);
 	mark_inode_dirty(dir);
 
@@ -114,7 +114,7 @@ affs_remove_hash(struct inode *dir, struct buffer_head *rem_bh)
 
 	affs_brelse(bh);
 
-	dir->i_mtime = dir->i_ctime = current_time(dir);
+	dir->i_mtime = inode_ctime_set_current(dir);
 	inode_inc_iversion(dir);
 	mark_inode_dirty(dir);
 
@@ -315,7 +315,7 @@ affs_remove_header(struct dentry *dentry)
 	else
 		clear_nlink(inode);
 	affs_unlock_link(inode);
-	inode->i_ctime = current_time(inode);
+	inode_ctime_set_current(inode);
 	mark_inode_dirty(inode);
 
 done:
diff --git a/fs/affs/inode.c b/fs/affs/inode.c
index 27f77a52c5c8..177bac4def5e 100644
--- a/fs/affs/inode.c
+++ b/fs/affs/inode.c
@@ -19,6 +19,7 @@ struct inode *affs_iget(struct super_block *sb, unsigned long ino)
 {
 	struct affs_sb_info	*sbi = AFFS_SB(sb);
 	struct buffer_head	*bh;
+	struct timespec64	ctime;
 	struct affs_tail	*tail;
 	struct inode		*inode;
 	u32			 block;
@@ -149,13 +150,13 @@ struct inode *affs_iget(struct super_block *sb, unsigned long ino)
 		break;
 	}
 
-	inode->i_mtime.tv_sec = inode->i_atime.tv_sec = inode->i_ctime.tv_sec
-		       = (be32_to_cpu(tail->change.days) * 86400LL +
-		         be32_to_cpu(tail->change.mins) * 60 +
-			 be32_to_cpu(tail->change.ticks) / 50 +
-			 AFFS_EPOCH_DELTA) +
-			 sys_tz.tz_minuteswest * 60;
-	inode->i_mtime.tv_nsec = inode->i_ctime.tv_nsec = inode->i_atime.tv_nsec = 0;
+	ctime.tv_sec = (be32_to_cpu(tail->change.days) * 86400LL +
+		        be32_to_cpu(tail->change.mins) * 60 +
+			be32_to_cpu(tail->change.ticks) / 50 +
+			AFFS_EPOCH_DELTA) +
+			sys_tz.tz_minuteswest * 60;
+	ctime.tv_nsec = 0;
+	inode->i_atime = inode->i_mtime = inode_ctime_set(inode, ctime);
 	affs_brelse(bh);
 	unlock_new_inode(inode);
 	return inode;
@@ -314,7 +315,7 @@ affs_new_inode(struct inode *dir)
 	inode->i_gid     = current_fsgid();
 	inode->i_ino     = block;
 	set_nlink(inode, 1);
-	inode->i_mtime   = inode->i_atime = inode->i_ctime = current_time(inode);
+	inode->i_mtime   = inode->i_atime = inode_ctime_set_current(inode);
 	atomic_set(&AFFS_I(inode)->i_opencnt, 0);
 	AFFS_I(inode)->i_blkcnt = 0;
 	AFFS_I(inode)->i_lc = NULL;
-- 
2.41.0


       reply	other threads:[~2023-06-21 14:48 UTC|newest]

Thread overview: 24+ 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   ` Jeff Layton [this message]
2023-06-21 16:39     ` [PATCH 10/79] affs: switch to new ctime accessors Jan Kara
2023-06-22 11:37     ` David Sterba
2023-06-21 14:45   ` [PATCH 12/79] fs: " Jeff Layton
2023-06-21 16:42     ` Jan Kara
2023-06-21 14:45   ` [PATCH 27/79] exfat: " Jeff Layton
2023-06-21 14:45   ` [PATCH 33/79] fuse: " Jeff Layton
2023-06-21 14:45   ` [PATCH 35/79] hfs: " Jeff Layton
2023-06-21 14:45   ` [PATCH 36/79] hfsplus: " Jeff Layton
2023-06-21 14:45   ` [PATCH 40/79] isofs: " Jeff Layton
2023-06-21 14:46   ` [PATCH 55/79] proc: " Jeff Layton
2023-06-30 22:13     ` Luis Chamberlain
2023-06-21 14:46   ` [PATCH 69/79] vboxsf: " Jeff Layton
2023-06-21 14:46   ` [PATCH 71/79] zonefs: " Jeff Layton
2023-06-22  0:48     ` Damien Le Moal
     [not found]   ` <20230621144735.55953-14-jlayton@kernel.org>
     [not found]     ` <20230621164808.5lhujni7qb36hhtk@quack3>
     [not found]       ` <646b7283ede4945b335ad16aea5ff60e1361241e.camel@kernel.org>
     [not found]         ` <20230622123050.thpf7qdnmidq3thj@quack3>
     [not found]           ` <d316dca7c248693575dae3d8032e9e3332bbae7a.camel@kernel.org>
     [not found]             ` <20230622145747.lokguccxtrrpgb3b@quack3>
     [not found]               ` <20230623-kaffee-volumen-014cfa91a2ee@brauner>
2023-07-03 10:12                 ` [PATCH 15/79] bfs: " Christian Brauner
2023-07-03 10:46                   ` Jeff Layton
2023-07-03 10:57                     ` Christian Brauner
     [not found] ` <20230621152141.5961cf5f@gandalf.local.home>
     [not found]   ` <2a5a069572b46b59dd16fe8d54e549a9b5bbb6eb.camel@kernel.org>
2023-06-23 12:41     ` [PATCH 00/79] fs: new accessors for inode->i_ctime Christian Brauner
2023-06-30 22:11   ` Luis Chamberlain
     [not found] ` <20230621144507.55591-2-jlayton@kernel.org>
     [not found]   ` <99b3c749-23d9-6f09-fb75-6a84f3d1b066@kernel.org>
2023-06-22 10:14     ` [PATCH 01/79] fs: add ctime accessors infrastructure Jeff Layton
2023-06-30 22:12   ` Luis Chamberlain
2023-07-12 15:31   ` Randy Dunlap
2023-07-12 15:34     ` 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=20230621144735.55953-9-jlayton@kernel.org \
    --to=jlayton@kernel.org \
    --cc=brauner@kernel.org \
    --cc=dsterba@suse.com \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).