All of lore.kernel.org
 help / color / mirror / Atom feed
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: linux-f2fs-devel@lists.sourceforge.net
Subject: [f2fs-dev] [PATCH v2 36/89] f2fs: convert to new timestamp accessors
Date: Wed,  4 Oct 2023 14:52:21 -0400	[thread overview]
Message-ID: <20231004185347.80880-34-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/f2fs/dir.c      |  6 +++---
 fs/f2fs/f2fs.h     | 10 ++++++----
 fs/f2fs/file.c     | 14 +++++++-------
 fs/f2fs/inline.c   |  2 +-
 fs/f2fs/inode.c    | 24 ++++++++++++------------
 fs/f2fs/namei.c    |  4 ++--
 fs/f2fs/recovery.c |  8 ++++----
 fs/f2fs/super.c    |  2 +-
 8 files changed, 36 insertions(+), 34 deletions(-)

diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c
index 8aa29fe2e87b..042593aed1ec 100644
--- a/fs/f2fs/dir.c
+++ b/fs/f2fs/dir.c
@@ -455,7 +455,7 @@ void f2fs_set_link(struct inode *dir, struct f2fs_dir_entry *de,
 	de->file_type = fs_umode_to_ftype(inode->i_mode);
 	set_page_dirty(page);
 
-	dir->i_mtime = inode_set_ctime_current(dir);
+	inode_set_mtime_to_ts(dir, inode_set_ctime_current(dir));
 	f2fs_mark_inode_dirty_sync(dir, false);
 	f2fs_put_page(page, 1);
 }
@@ -609,7 +609,7 @@ void f2fs_update_parent_metadata(struct inode *dir, struct inode *inode,
 			f2fs_i_links_write(dir, true);
 		clear_inode_flag(inode, FI_NEW_INODE);
 	}
-	dir->i_mtime = inode_set_ctime_current(dir);
+	inode_set_mtime_to_ts(dir, inode_set_ctime_current(dir));
 	f2fs_mark_inode_dirty_sync(dir, false);
 
 	if (F2FS_I(dir)->i_current_depth != current_depth)
@@ -919,7 +919,7 @@ void f2fs_delete_entry(struct f2fs_dir_entry *dentry, struct page *page,
 	}
 	f2fs_put_page(page, 1);
 
-	dir->i_mtime = inode_set_ctime_current(dir);
+	inode_set_mtime_to_ts(dir, inode_set_ctime_current(dir));
 	f2fs_mark_inode_dirty_sync(dir, false);
 
 	if (inode)
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 3878288122ee..9043cedfa12b 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -3318,13 +3318,15 @@ static inline void clear_file(struct inode *inode, int type)
 
 static inline bool f2fs_is_time_consistent(struct inode *inode)
 {
-	struct timespec64 ctime = inode_get_ctime(inode);
+	struct timespec64 ts = inode_get_atime(inode);
 
-	if (!timespec64_equal(F2FS_I(inode)->i_disk_time, &inode->i_atime))
+	if (!timespec64_equal(F2FS_I(inode)->i_disk_time, &ts))
 		return false;
-	if (!timespec64_equal(F2FS_I(inode)->i_disk_time + 1, &ctime))
+	ts = inode_get_ctime(inode);
+	if (!timespec64_equal(F2FS_I(inode)->i_disk_time + 1, &ts))
 		return false;
-	if (!timespec64_equal(F2FS_I(inode)->i_disk_time + 2, &inode->i_mtime))
+	ts = inode_get_mtime(inode);
+	if (!timespec64_equal(F2FS_I(inode)->i_disk_time + 2, &ts))
 		return false;
 	return true;
 }
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 161826c6e200..5769c9879e79 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -798,7 +798,7 @@ int f2fs_truncate(struct inode *inode)
 	if (err)
 		return err;
 
-	inode->i_mtime = inode_set_ctime_current(inode);
+	inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode));
 	f2fs_mark_inode_dirty_sync(inode, false);
 	return 0;
 }
@@ -905,9 +905,9 @@ static void __setattr_copy(struct mnt_idmap *idmap,
 	i_uid_update(idmap, attr, inode);
 	i_gid_update(idmap, attr, inode);
 	if (ia_valid & ATTR_ATIME)
-		inode->i_atime = attr->ia_atime;
+		inode_set_atime_to_ts(inode, attr->ia_atime);
 	if (ia_valid & ATTR_MTIME)
-		inode->i_mtime = attr->ia_mtime;
+		inode_set_mtime_to_ts(inode, attr->ia_mtime);
 	if (ia_valid & ATTR_CTIME)
 		inode_set_ctime_to_ts(inode, attr->ia_ctime);
 	if (ia_valid & ATTR_MODE) {
@@ -1012,7 +1012,7 @@ int f2fs_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
 			return err;
 
 		spin_lock(&F2FS_I(inode)->i_size_lock);
-		inode->i_mtime = inode_set_ctime_current(inode);
+		inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode));
 		F2FS_I(inode)->last_disk_size = i_size_read(inode);
 		spin_unlock(&F2FS_I(inode)->i_size_lock);
 	}
@@ -1840,7 +1840,7 @@ static long f2fs_fallocate(struct file *file, int mode,
 	}
 
 	if (!ret) {
-		inode->i_mtime = inode_set_ctime_current(inode);
+		inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode));
 		f2fs_mark_inode_dirty_sync(inode, false);
 		f2fs_update_time(F2FS_I_SB(inode), REQ_TIME);
 	}
@@ -2888,10 +2888,10 @@ static int f2fs_move_file_range(struct file *file_in, loff_t pos_in,
 	if (ret)
 		goto out_unlock;
 
-	src->i_mtime = inode_set_ctime_current(src);
+	inode_set_mtime_to_ts(src, inode_set_ctime_current(src));
 	f2fs_mark_inode_dirty_sync(src, false);
 	if (src != dst) {
-		dst->i_mtime = inode_set_ctime_current(dst);
+		inode_set_mtime_to_ts(dst, inode_set_ctime_current(dst));
 		f2fs_mark_inode_dirty_sync(dst, false);
 	}
 	f2fs_update_time(sbi, REQ_TIME);
diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c
index 2fe25619ccb5..ac00423f117b 100644
--- a/fs/f2fs/inline.c
+++ b/fs/f2fs/inline.c
@@ -699,7 +699,7 @@ void f2fs_delete_inline_entry(struct f2fs_dir_entry *dentry, struct page *page,
 	set_page_dirty(page);
 	f2fs_put_page(page, 1);
 
-	dir->i_mtime = inode_set_ctime_current(dir);
+	inode_set_mtime_to_ts(dir, inode_set_ctime_current(dir));
 	f2fs_mark_inode_dirty_sync(dir, false);
 
 	if (inode)
diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
index cde243840abd..5779c7edd49b 100644
--- a/fs/f2fs/inode.c
+++ b/fs/f2fs/inode.c
@@ -386,9 +386,9 @@ static void init_idisk_time(struct inode *inode)
 {
 	struct f2fs_inode_info *fi = F2FS_I(inode);
 
-	fi->i_disk_time[0] = inode->i_atime;
+	fi->i_disk_time[0] = inode_get_atime(inode);
 	fi->i_disk_time[1] = inode_get_ctime(inode);
-	fi->i_disk_time[2] = inode->i_mtime;
+	fi->i_disk_time[2] = inode_get_mtime(inode);
 }
 
 static int do_read_inode(struct inode *inode)
@@ -417,12 +417,12 @@ static int do_read_inode(struct inode *inode)
 	inode->i_size = le64_to_cpu(ri->i_size);
 	inode->i_blocks = SECTOR_FROM_BLOCK(le64_to_cpu(ri->i_blocks) - 1);
 
-	inode->i_atime.tv_sec = le64_to_cpu(ri->i_atime);
+	inode_set_atime(inode, le64_to_cpu(ri->i_atime),
+			le32_to_cpu(ri->i_atime_nsec));
 	inode_set_ctime(inode, le64_to_cpu(ri->i_ctime),
 			le32_to_cpu(ri->i_ctime_nsec));
-	inode->i_mtime.tv_sec = le64_to_cpu(ri->i_mtime);
-	inode->i_atime.tv_nsec = le32_to_cpu(ri->i_atime_nsec);
-	inode->i_mtime.tv_nsec = le32_to_cpu(ri->i_mtime_nsec);
+	inode_set_mtime(inode, le64_to_cpu(ri->i_mtime),
+			le32_to_cpu(ri->i_mtime_nsec));
 	inode->i_generation = le32_to_cpu(ri->i_generation);
 	if (S_ISDIR(inode->i_mode))
 		fi->i_current_depth = le32_to_cpu(ri->i_current_depth);
@@ -698,12 +698,12 @@ void f2fs_update_inode(struct inode *inode, struct page *node_page)
 	}
 	set_raw_inline(inode, ri);
 
-	ri->i_atime = cpu_to_le64(inode->i_atime.tv_sec);
-	ri->i_ctime = cpu_to_le64(inode_get_ctime(inode).tv_sec);
-	ri->i_mtime = cpu_to_le64(inode->i_mtime.tv_sec);
-	ri->i_atime_nsec = cpu_to_le32(inode->i_atime.tv_nsec);
-	ri->i_ctime_nsec = cpu_to_le32(inode_get_ctime(inode).tv_nsec);
-	ri->i_mtime_nsec = cpu_to_le32(inode->i_mtime.tv_nsec);
+	ri->i_atime = cpu_to_le64(inode_get_atime_sec(inode));
+	ri->i_ctime = cpu_to_le64(inode_get_ctime_sec(inode));
+	ri->i_mtime = cpu_to_le64(inode_get_mtime_sec(inode));
+	ri->i_atime_nsec = cpu_to_le32(inode_get_atime_nsec(inode));
+	ri->i_ctime_nsec = cpu_to_le32(inode_get_ctime_nsec(inode));
+	ri->i_mtime_nsec = cpu_to_le32(inode_get_mtime_nsec(inode));
 	if (S_ISDIR(inode->i_mode))
 		ri->i_current_depth =
 			cpu_to_le32(F2FS_I(inode)->i_current_depth);
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index 193b22a2d6bf..d0053b0284d8 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -243,8 +243,8 @@ static struct inode *f2fs_new_inode(struct mnt_idmap *idmap,
 
 	inode->i_ino = ino;
 	inode->i_blocks = 0;
-	inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode);
-	F2FS_I(inode)->i_crtime = inode->i_mtime;
+	simple_inode_init_ts(inode);
+	F2FS_I(inode)->i_crtime = inode_get_mtime(inode);
 	inode->i_generation = get_random_u32();
 
 	if (S_ISDIR(inode->i_mode))
diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c
index 7be60df277a5..b56d0f1078a7 100644
--- a/fs/f2fs/recovery.c
+++ b/fs/f2fs/recovery.c
@@ -320,12 +320,12 @@ static int recover_inode(struct inode *inode, struct page *page)
 	}
 
 	f2fs_i_size_write(inode, le64_to_cpu(raw->i_size));
-	inode->i_atime.tv_sec = le64_to_cpu(raw->i_atime);
+	inode_set_atime(inode, le64_to_cpu(raw->i_atime),
+			le32_to_cpu(raw->i_atime_nsec));
 	inode_set_ctime(inode, le64_to_cpu(raw->i_ctime),
 			le32_to_cpu(raw->i_ctime_nsec));
-	inode->i_mtime.tv_sec = le64_to_cpu(raw->i_mtime);
-	inode->i_atime.tv_nsec = le32_to_cpu(raw->i_atime_nsec);
-	inode->i_mtime.tv_nsec = le32_to_cpu(raw->i_mtime_nsec);
+	inode_set_mtime(inode, le64_to_cpu(raw->i_mtime),
+			le32_to_cpu(raw->i_mtime_nsec));
 
 	F2FS_I(inode)->i_advise = raw->i_advise;
 	F2FS_I(inode)->i_flags = le32_to_cpu(raw->i_flags);
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index a61be3204c54..0118405467ce 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -2758,7 +2758,7 @@ static ssize_t f2fs_quota_write(struct super_block *sb, int type,
 
 	if (len == towrite)
 		return err;
-	inode->i_mtime = inode_set_ctime_current(inode);
+	inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode));
 	f2fs_mark_inode_dirty_sync(inode, false);
 	return len - towrite;
 }
-- 
2.41.0



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

WARNING: multiple messages have this Message-ID (diff)
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: linux-f2fs-devel@lists.sourceforge.net
Subject: [PATCH v2 36/89] f2fs: convert to new timestamp accessors
Date: Wed,  4 Oct 2023 14:52:21 -0400	[thread overview]
Message-ID: <20231004185347.80880-34-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/f2fs/dir.c      |  6 +++---
 fs/f2fs/f2fs.h     | 10 ++++++----
 fs/f2fs/file.c     | 14 +++++++-------
 fs/f2fs/inline.c   |  2 +-
 fs/f2fs/inode.c    | 24 ++++++++++++------------
 fs/f2fs/namei.c    |  4 ++--
 fs/f2fs/recovery.c |  8 ++++----
 fs/f2fs/super.c    |  2 +-
 8 files changed, 36 insertions(+), 34 deletions(-)

diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c
index 8aa29fe2e87b..042593aed1ec 100644
--- a/fs/f2fs/dir.c
+++ b/fs/f2fs/dir.c
@@ -455,7 +455,7 @@ void f2fs_set_link(struct inode *dir, struct f2fs_dir_entry *de,
 	de->file_type = fs_umode_to_ftype(inode->i_mode);
 	set_page_dirty(page);
 
-	dir->i_mtime = inode_set_ctime_current(dir);
+	inode_set_mtime_to_ts(dir, inode_set_ctime_current(dir));
 	f2fs_mark_inode_dirty_sync(dir, false);
 	f2fs_put_page(page, 1);
 }
@@ -609,7 +609,7 @@ void f2fs_update_parent_metadata(struct inode *dir, struct inode *inode,
 			f2fs_i_links_write(dir, true);
 		clear_inode_flag(inode, FI_NEW_INODE);
 	}
-	dir->i_mtime = inode_set_ctime_current(dir);
+	inode_set_mtime_to_ts(dir, inode_set_ctime_current(dir));
 	f2fs_mark_inode_dirty_sync(dir, false);
 
 	if (F2FS_I(dir)->i_current_depth != current_depth)
@@ -919,7 +919,7 @@ void f2fs_delete_entry(struct f2fs_dir_entry *dentry, struct page *page,
 	}
 	f2fs_put_page(page, 1);
 
-	dir->i_mtime = inode_set_ctime_current(dir);
+	inode_set_mtime_to_ts(dir, inode_set_ctime_current(dir));
 	f2fs_mark_inode_dirty_sync(dir, false);
 
 	if (inode)
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 3878288122ee..9043cedfa12b 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -3318,13 +3318,15 @@ static inline void clear_file(struct inode *inode, int type)
 
 static inline bool f2fs_is_time_consistent(struct inode *inode)
 {
-	struct timespec64 ctime = inode_get_ctime(inode);
+	struct timespec64 ts = inode_get_atime(inode);
 
-	if (!timespec64_equal(F2FS_I(inode)->i_disk_time, &inode->i_atime))
+	if (!timespec64_equal(F2FS_I(inode)->i_disk_time, &ts))
 		return false;
-	if (!timespec64_equal(F2FS_I(inode)->i_disk_time + 1, &ctime))
+	ts = inode_get_ctime(inode);
+	if (!timespec64_equal(F2FS_I(inode)->i_disk_time + 1, &ts))
 		return false;
-	if (!timespec64_equal(F2FS_I(inode)->i_disk_time + 2, &inode->i_mtime))
+	ts = inode_get_mtime(inode);
+	if (!timespec64_equal(F2FS_I(inode)->i_disk_time + 2, &ts))
 		return false;
 	return true;
 }
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 161826c6e200..5769c9879e79 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -798,7 +798,7 @@ int f2fs_truncate(struct inode *inode)
 	if (err)
 		return err;
 
-	inode->i_mtime = inode_set_ctime_current(inode);
+	inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode));
 	f2fs_mark_inode_dirty_sync(inode, false);
 	return 0;
 }
@@ -905,9 +905,9 @@ static void __setattr_copy(struct mnt_idmap *idmap,
 	i_uid_update(idmap, attr, inode);
 	i_gid_update(idmap, attr, inode);
 	if (ia_valid & ATTR_ATIME)
-		inode->i_atime = attr->ia_atime;
+		inode_set_atime_to_ts(inode, attr->ia_atime);
 	if (ia_valid & ATTR_MTIME)
-		inode->i_mtime = attr->ia_mtime;
+		inode_set_mtime_to_ts(inode, attr->ia_mtime);
 	if (ia_valid & ATTR_CTIME)
 		inode_set_ctime_to_ts(inode, attr->ia_ctime);
 	if (ia_valid & ATTR_MODE) {
@@ -1012,7 +1012,7 @@ int f2fs_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
 			return err;
 
 		spin_lock(&F2FS_I(inode)->i_size_lock);
-		inode->i_mtime = inode_set_ctime_current(inode);
+		inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode));
 		F2FS_I(inode)->last_disk_size = i_size_read(inode);
 		spin_unlock(&F2FS_I(inode)->i_size_lock);
 	}
@@ -1840,7 +1840,7 @@ static long f2fs_fallocate(struct file *file, int mode,
 	}
 
 	if (!ret) {
-		inode->i_mtime = inode_set_ctime_current(inode);
+		inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode));
 		f2fs_mark_inode_dirty_sync(inode, false);
 		f2fs_update_time(F2FS_I_SB(inode), REQ_TIME);
 	}
@@ -2888,10 +2888,10 @@ static int f2fs_move_file_range(struct file *file_in, loff_t pos_in,
 	if (ret)
 		goto out_unlock;
 
-	src->i_mtime = inode_set_ctime_current(src);
+	inode_set_mtime_to_ts(src, inode_set_ctime_current(src));
 	f2fs_mark_inode_dirty_sync(src, false);
 	if (src != dst) {
-		dst->i_mtime = inode_set_ctime_current(dst);
+		inode_set_mtime_to_ts(dst, inode_set_ctime_current(dst));
 		f2fs_mark_inode_dirty_sync(dst, false);
 	}
 	f2fs_update_time(sbi, REQ_TIME);
diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c
index 2fe25619ccb5..ac00423f117b 100644
--- a/fs/f2fs/inline.c
+++ b/fs/f2fs/inline.c
@@ -699,7 +699,7 @@ void f2fs_delete_inline_entry(struct f2fs_dir_entry *dentry, struct page *page,
 	set_page_dirty(page);
 	f2fs_put_page(page, 1);
 
-	dir->i_mtime = inode_set_ctime_current(dir);
+	inode_set_mtime_to_ts(dir, inode_set_ctime_current(dir));
 	f2fs_mark_inode_dirty_sync(dir, false);
 
 	if (inode)
diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
index cde243840abd..5779c7edd49b 100644
--- a/fs/f2fs/inode.c
+++ b/fs/f2fs/inode.c
@@ -386,9 +386,9 @@ static void init_idisk_time(struct inode *inode)
 {
 	struct f2fs_inode_info *fi = F2FS_I(inode);
 
-	fi->i_disk_time[0] = inode->i_atime;
+	fi->i_disk_time[0] = inode_get_atime(inode);
 	fi->i_disk_time[1] = inode_get_ctime(inode);
-	fi->i_disk_time[2] = inode->i_mtime;
+	fi->i_disk_time[2] = inode_get_mtime(inode);
 }
 
 static int do_read_inode(struct inode *inode)
@@ -417,12 +417,12 @@ static int do_read_inode(struct inode *inode)
 	inode->i_size = le64_to_cpu(ri->i_size);
 	inode->i_blocks = SECTOR_FROM_BLOCK(le64_to_cpu(ri->i_blocks) - 1);
 
-	inode->i_atime.tv_sec = le64_to_cpu(ri->i_atime);
+	inode_set_atime(inode, le64_to_cpu(ri->i_atime),
+			le32_to_cpu(ri->i_atime_nsec));
 	inode_set_ctime(inode, le64_to_cpu(ri->i_ctime),
 			le32_to_cpu(ri->i_ctime_nsec));
-	inode->i_mtime.tv_sec = le64_to_cpu(ri->i_mtime);
-	inode->i_atime.tv_nsec = le32_to_cpu(ri->i_atime_nsec);
-	inode->i_mtime.tv_nsec = le32_to_cpu(ri->i_mtime_nsec);
+	inode_set_mtime(inode, le64_to_cpu(ri->i_mtime),
+			le32_to_cpu(ri->i_mtime_nsec));
 	inode->i_generation = le32_to_cpu(ri->i_generation);
 	if (S_ISDIR(inode->i_mode))
 		fi->i_current_depth = le32_to_cpu(ri->i_current_depth);
@@ -698,12 +698,12 @@ void f2fs_update_inode(struct inode *inode, struct page *node_page)
 	}
 	set_raw_inline(inode, ri);
 
-	ri->i_atime = cpu_to_le64(inode->i_atime.tv_sec);
-	ri->i_ctime = cpu_to_le64(inode_get_ctime(inode).tv_sec);
-	ri->i_mtime = cpu_to_le64(inode->i_mtime.tv_sec);
-	ri->i_atime_nsec = cpu_to_le32(inode->i_atime.tv_nsec);
-	ri->i_ctime_nsec = cpu_to_le32(inode_get_ctime(inode).tv_nsec);
-	ri->i_mtime_nsec = cpu_to_le32(inode->i_mtime.tv_nsec);
+	ri->i_atime = cpu_to_le64(inode_get_atime_sec(inode));
+	ri->i_ctime = cpu_to_le64(inode_get_ctime_sec(inode));
+	ri->i_mtime = cpu_to_le64(inode_get_mtime_sec(inode));
+	ri->i_atime_nsec = cpu_to_le32(inode_get_atime_nsec(inode));
+	ri->i_ctime_nsec = cpu_to_le32(inode_get_ctime_nsec(inode));
+	ri->i_mtime_nsec = cpu_to_le32(inode_get_mtime_nsec(inode));
 	if (S_ISDIR(inode->i_mode))
 		ri->i_current_depth =
 			cpu_to_le32(F2FS_I(inode)->i_current_depth);
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index 193b22a2d6bf..d0053b0284d8 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -243,8 +243,8 @@ static struct inode *f2fs_new_inode(struct mnt_idmap *idmap,
 
 	inode->i_ino = ino;
 	inode->i_blocks = 0;
-	inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode);
-	F2FS_I(inode)->i_crtime = inode->i_mtime;
+	simple_inode_init_ts(inode);
+	F2FS_I(inode)->i_crtime = inode_get_mtime(inode);
 	inode->i_generation = get_random_u32();
 
 	if (S_ISDIR(inode->i_mode))
diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c
index 7be60df277a5..b56d0f1078a7 100644
--- a/fs/f2fs/recovery.c
+++ b/fs/f2fs/recovery.c
@@ -320,12 +320,12 @@ static int recover_inode(struct inode *inode, struct page *page)
 	}
 
 	f2fs_i_size_write(inode, le64_to_cpu(raw->i_size));
-	inode->i_atime.tv_sec = le64_to_cpu(raw->i_atime);
+	inode_set_atime(inode, le64_to_cpu(raw->i_atime),
+			le32_to_cpu(raw->i_atime_nsec));
 	inode_set_ctime(inode, le64_to_cpu(raw->i_ctime),
 			le32_to_cpu(raw->i_ctime_nsec));
-	inode->i_mtime.tv_sec = le64_to_cpu(raw->i_mtime);
-	inode->i_atime.tv_nsec = le32_to_cpu(raw->i_atime_nsec);
-	inode->i_mtime.tv_nsec = le32_to_cpu(raw->i_mtime_nsec);
+	inode_set_mtime(inode, le64_to_cpu(raw->i_mtime),
+			le32_to_cpu(raw->i_mtime_nsec));
 
 	F2FS_I(inode)->i_advise = raw->i_advise;
 	F2FS_I(inode)->i_flags = le32_to_cpu(raw->i_flags);
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index a61be3204c54..0118405467ce 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -2758,7 +2758,7 @@ static ssize_t f2fs_quota_write(struct super_block *sb, int type,
 
 	if (len == towrite)
 		return err;
-	inode->i_mtime = inode_set_ctime_current(inode);
+	inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode));
 	f2fs_mark_inode_dirty_sync(inode, false);
 	return len - towrite;
 }
-- 
2.41.0


  parent reply	other threads:[~2023-10-04 18:54 UTC|newest]

Thread overview: 115+ 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:52 ` Jeff Layton
2023-10-04 18:52 ` Jeff Layton
2023-10-04 18:52 ` Jeff Layton
2023-10-04 18:52 ` [f2fs-dev] " Jeff Layton
2023-10-04 18:51 ` [PATCH v2 03/89] spufs: convert to new timestamp accessors Jeff Layton
2023-10-04 18:51   ` 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     ` 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   ` Jeff Layton [this message]
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     ` 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     ` 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   ` [PATCH v2 54/89] ntfs: " Jeff Layton
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     ` 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   ` Jeff Layton
2023-10-04 18:52   ` Jeff Layton
2023-10-04 18:52   ` Jeff Layton
2023-10-04 18:52   ` [f2fs-dev] " Jeff Layton
2023-10-04 18:52   ` [PATCH v2 02/89] fs: convert core infrastructure to new timestamp accessors Jeff Layton
2023-10-04 18:52     ` Jeff Layton
2023-10-04 18:52     ` Jeff Layton
2023-10-04 18:52     ` Jeff Layton
2023-10-04 18:52     ` [f2fs-dev] " Jeff Layton
2023-10-09 16:09 ` [PATCH v2 00/89] fs: new accessor methods for inode atime and mtime Christian Brauner
2023-10-09 16:09   ` Christian Brauner
2023-10-09 16:09   ` Christian Brauner
2023-10-09 16:09   ` Christian Brauner
2023-10-09 16:09   ` Christian Brauner
2023-10-09 16:09   ` [f2fs-dev] " 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-34-jlayton@kernel.org \
    --to=jlayton@kernel.org \
    --cc=brauner@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.