[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230621144735.55953-30-jlayton@kernel.org>
Date: Wed, 21 Jun 2023 10:45:44 -0400
From: Jeff Layton <jlayton@...nel.org>
To: Christian Brauner <brauner@...nel.org>,
OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>
Cc: Al Viro <viro@...iv.linux.org.uk>, Jan Kara <jack@...e.cz>,
linux-kernel@...r.kernel.org
Subject: [PATCH 31/79] fat: switch to new ctime accessors
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@...nel.org>
---
fs/fat/inode.c | 8 +++++---
fs/fat/misc.c | 7 +++++--
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index d99b8549ec8f..b34ae7298796 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -562,7 +562,7 @@ int fat_fill_inode(struct inode *inode, struct msdos_dir_entry *de)
& ~((loff_t)sbi->cluster_size - 1)) >> 9;
fat_time_fat2unix(sbi, &inode->i_mtime, de->time, de->date, 0);
- inode->i_ctime = inode->i_mtime;
+ inode_ctime_set(inode, inode->i_mtime);
if (sbi->options.isvfat) {
fat_time_fat2unix(sbi, &inode->i_atime, 0, de->adate, 0);
fat_time_fat2unix(sbi, &MSDOS_I(inode)->i_crtime, de->ctime,
@@ -1407,8 +1407,10 @@ static int fat_read_root(struct inode *inode)
MSDOS_I(inode)->mmu_private = inode->i_size;
fat_save_attrs(inode, ATTR_DIR);
- inode->i_mtime.tv_sec = inode->i_atime.tv_sec = inode->i_ctime.tv_sec = 0;
- inode->i_mtime.tv_nsec = inode->i_atime.tv_nsec = inode->i_ctime.tv_nsec = 0;
+ inode->i_mtime.tv_sec = inode->i_atime.tv_sec = inode_ctime_set_sec(inode,
+ 0);
+ inode->i_mtime.tv_nsec = inode->i_atime.tv_nsec = inode_ctime_set_nsec(inode,
+ 0);
set_nlink(inode, fat_subdirs(inode)+2);
return 0;
diff --git a/fs/fat/misc.c b/fs/fat/misc.c
index 7e5d6ae305f2..0d3ba6001ff0 100644
--- a/fs/fat/misc.c
+++ b/fs/fat/misc.c
@@ -331,8 +331,11 @@ int fat_truncate_time(struct inode *inode, struct timespec64 *now, int flags)
* identical in memory. all mtime updates will be applied to ctime,
* but ctime updates are ignored.
*/
- if (flags & S_MTIME)
- inode->i_mtime = inode->i_ctime = fat_truncate_mtime(sbi, now);
+ if (flags & S_MTIME) {
+ ts = fat_truncate_mtime(sbi, now);
+ inode->i_mtime = ts;
+ inode_ctime_set(inode, ts);
+ }
return 0;
}
--
2.41.0
Powered by blists - more mailing lists