linux-fsdevel.vger.kernel.org archive mirror
 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-ext4@vger.kernel.org
Subject: [PATCH 33/87] fs/ext2: convert to new inode {a,m}time accessors
Date: Thu, 28 Sep 2023 07:02:42 -0400	[thread overview]
Message-ID: <20230928110413.33032-32-jlayton@kernel.org> (raw)
In-Reply-To: <20230928110413.33032-1-jlayton@kernel.org>

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 fs/ext2/dir.c    |  6 +++---
 fs/ext2/ialloc.c |  2 +-
 fs/ext2/inode.c  | 11 +++++------
 fs/ext2/super.c  |  2 +-
 4 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c
index b335f17f682f..c7900868171b 100644
--- a/fs/ext2/dir.c
+++ b/fs/ext2/dir.c
@@ -468,7 +468,7 @@ int ext2_set_link(struct inode *dir, struct ext2_dir_entry_2 *de,
 	ext2_set_de_type(de, inode);
 	ext2_commit_chunk(page, pos, len);
 	if (update_times)
-		dir->i_mtime = inode_set_ctime_current(dir);
+		inode_set_mtime_to_ts(dir, inode_set_ctime_current(dir));
 	EXT2_I(dir)->i_flags &= ~EXT2_BTREE_FL;
 	mark_inode_dirty(dir);
 	return ext2_handle_dirsync(dir);
@@ -555,7 +555,7 @@ int ext2_add_link (struct dentry *dentry, struct inode *inode)
 	de->inode = cpu_to_le32(inode->i_ino);
 	ext2_set_de_type (de, inode);
 	ext2_commit_chunk(page, pos, rec_len);
-	dir->i_mtime = inode_set_ctime_current(dir);
+	inode_set_mtime_to_ts(dir, inode_set_ctime_current(dir));
 	EXT2_I(dir)->i_flags &= ~EXT2_BTREE_FL;
 	mark_inode_dirty(dir);
 	err = ext2_handle_dirsync(dir);
@@ -606,7 +606,7 @@ int ext2_delete_entry(struct ext2_dir_entry_2 *dir, struct page *page)
 		pde->rec_len = ext2_rec_len_to_disk(to - from);
 	dir->inode = 0;
 	ext2_commit_chunk(page, pos, to - from);
-	inode->i_mtime = inode_set_ctime_current(inode);
+	inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode));
 	EXT2_I(inode)->i_flags &= ~EXT2_BTREE_FL;
 	mark_inode_dirty(inode);
 	return ext2_handle_dirsync(inode);
diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c
index c24d0de95a83..fdf63e9c6e7c 100644
--- a/fs/ext2/ialloc.c
+++ b/fs/ext2/ialloc.c
@@ -546,7 +546,7 @@ struct inode *ext2_new_inode(struct inode *dir, umode_t mode,
 
 	inode->i_ino = ino;
 	inode->i_blocks = 0;
-	inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode);
+	simple_inode_init_ts(inode);
 	memset(ei->i_data, 0, sizeof(ei->i_data));
 	ei->i_flags =
 		ext2_mask_flags(mode, EXT2_I(dir)->i_flags & EXT2_FL_INHERITED);
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index 314b415ee518..d8c9eaae383f 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -1291,7 +1291,7 @@ static int ext2_setsize(struct inode *inode, loff_t newsize)
 	__ext2_truncate_blocks(inode, newsize);
 	filemap_invalidate_unlock(inode->i_mapping);
 
-	inode->i_mtime = inode_set_ctime_current(inode);
+	inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode));
 	if (inode_needs_sync(inode)) {
 		sync_mapping_buffers(inode->i_mapping);
 		sync_inode_metadata(inode, 1);
@@ -1412,10 +1412,9 @@ struct inode *ext2_iget (struct super_block *sb, unsigned long ino)
 	i_gid_write(inode, i_gid);
 	set_nlink(inode, le16_to_cpu(raw_inode->i_links_count));
 	inode->i_size = le32_to_cpu(raw_inode->i_size);
-	inode->i_atime.tv_sec = (signed)le32_to_cpu(raw_inode->i_atime);
+	inode_set_atime(inode, (signed)le32_to_cpu(raw_inode->i_atime), 0);
 	inode_set_ctime(inode, (signed)le32_to_cpu(raw_inode->i_ctime), 0);
-	inode->i_mtime.tv_sec = (signed)le32_to_cpu(raw_inode->i_mtime);
-	inode->i_atime.tv_nsec = inode->i_mtime.tv_nsec = 0;
+	inode_set_mtime(inode, (signed)le32_to_cpu(raw_inode->i_mtime), 0);
 	ei->i_dtime = le32_to_cpu(raw_inode->i_dtime);
 	/* We now have enough fields to check if the inode was active or not.
 	 * This is needed because nfsd might try to access dead inodes
@@ -1544,9 +1543,9 @@ static int __ext2_write_inode(struct inode *inode, int do_sync)
 	}
 	raw_inode->i_links_count = cpu_to_le16(inode->i_nlink);
 	raw_inode->i_size = cpu_to_le32(inode->i_size);
-	raw_inode->i_atime = cpu_to_le32(inode->i_atime.tv_sec);
+	raw_inode->i_atime = cpu_to_le32(inode_get_atime(inode).tv_sec);
 	raw_inode->i_ctime = cpu_to_le32(inode_get_ctime(inode).tv_sec);
-	raw_inode->i_mtime = cpu_to_le32(inode->i_mtime.tv_sec);
+	raw_inode->i_mtime = cpu_to_le32(inode_get_mtime(inode).tv_sec);
 
 	raw_inode->i_blocks = cpu_to_le32(inode->i_blocks);
 	raw_inode->i_dtime = cpu_to_le32(ei->i_dtime);
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index aaf3e3e88cb2..645ee6142f69 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -1572,7 +1572,7 @@ static ssize_t ext2_quota_write(struct super_block *sb, int type,
 	if (inode->i_size < off+len-towrite)
 		i_size_write(inode, off+len-towrite);
 	inode_inc_iversion(inode);
-	inode->i_mtime = inode_set_ctime_current(inode);
+	inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode));
 	mark_inode_dirty(inode);
 	return len - towrite;
 }
-- 
2.41.0


  parent reply	other threads:[~2023-09-28 11:06 UTC|newest]

Thread overview: 95+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-28 11:02 [PATCH 00/87] fs: new accessor methods for atime and mtime Jeff Layton
2023-09-28 11:02 ` [PATCH 02/87] fs: convert core infrastructure to new {a,m}time accessors Jeff Layton
2023-09-28 11:02   ` [PATCH 03/87] arch/powerpc/platforms/cell/spufs: convert to new inode " Jeff Layton
2023-09-28 11:02   ` [PATCH 04/87] arch/s390/hypfs: " Jeff Layton
2023-09-28 11:02   ` [PATCH 05/87] drivers/android: " Jeff Layton
2023-09-28 11:02   ` [PATCH 06/87] drivers/char: " Jeff Layton
2023-09-28 11:02   ` [PATCH 07/87] drivers/infiniband/hw/qib: " Jeff Layton
2023-09-28 11:02   ` [PATCH 08/87] drivers/misc/ibmasm: " Jeff Layton
2023-09-28 11:02   ` [PATCH 09/87] drivers/misc: " Jeff Layton
2023-09-28 11:02   ` [PATCH 10/87] drivers/platform/x86: " Jeff Layton
2023-09-28 12:34     ` Hans de Goede
2023-09-28 11:02   ` [PATCH 11/87] drivers/tty: " Jeff Layton
2023-09-28 12:13     ` Greg KH
2023-09-28 12:23       ` Jeff Layton
2023-09-28 11:02   ` [PATCH 12/87] drivers/usb/core: " Jeff Layton
2023-09-28 11:02   ` [PATCH 13/87] drivers/usb/gadget/function: " Jeff Layton
2023-09-28 11:02   ` [PATCH 14/87] drivers/usb/gadget/legacy: " Jeff Layton
2023-09-28 11:02   ` [PATCH 15/87] fs/9p: " Jeff Layton
2023-09-28 11:02   ` [PATCH 16/87] fs/adfs: " Jeff Layton
2023-09-28 11:02   ` [PATCH 17/87] fs/affs: " Jeff Layton
2023-09-28 11:02   ` [PATCH 18/87] fs/afs: " Jeff Layton
2023-09-28 11:02   ` [PATCH 19/87] fs/autofs: " Jeff Layton
2023-09-28 11:02   ` [PATCH 20/87] fs/befs: " Jeff Layton
2023-09-28 11:02   ` [PATCH 21/87] fs/bfs: " Jeff Layton
2023-09-28 11:02   ` [PATCH 22/87] fs/btrfs: " Jeff Layton
2023-09-28 11:02   ` [PATCH 23/87] fs/ceph: " Jeff Layton
2023-09-28 11:02   ` [PATCH 24/87] fs/coda: " Jeff Layton
2023-09-28 11:02   ` [PATCH 25/87] fs/configfs: " Jeff Layton
2023-09-28 11:02   ` [PATCH 26/87] fs/cramfs: " Jeff Layton
2023-09-28 11:02   ` [PATCH 27/87] fs/debugfs: " Jeff Layton
2023-09-28 11:02   ` [PATCH 28/87] fs/devpts: " Jeff Layton
2023-09-28 11:02   ` [PATCH 29/87] fs/efivarfs: " Jeff Layton
2023-09-28 11:02   ` [PATCH 30/87] fs/efs: " Jeff Layton
2023-09-28 11:02   ` [PATCH 31/87] fs/erofs: " Jeff Layton
2023-09-28 11:02   ` [PATCH 32/87] fs/exfat: " Jeff Layton
2023-09-28 11:02   ` Jeff Layton [this message]
2023-09-28 11:02   ` [PATCH 34/87] fs/ext4: " Jeff Layton
2023-09-28 11:02   ` [PATCH 35/87] fs/f2fs: " Jeff Layton
2023-09-28 11:02   ` [PATCH 36/87] fs/fat: " Jeff Layton
2023-09-28 11:02   ` [PATCH 37/87] fs/freevxfs: " Jeff Layton
2023-09-28 11:02   ` [PATCH 38/87] fs/fuse: " Jeff Layton
2023-09-28 11:02   ` [PATCH 39/87] fs/gfs2: " Jeff Layton
2023-09-28 11:02   ` [PATCH 40/87] fs/hfs: " Jeff Layton
2023-09-28 11:02   ` [PATCH 41/87] fs/hfsplus: " Jeff Layton
2023-09-28 11:02   ` [PATCH 42/87] fs/hostfs: " Jeff Layton
2023-09-28 11:02   ` [PATCH 43/87] fs/hpfs: " Jeff Layton
2023-09-28 11:02   ` [PATCH 44/87] fs/hugetlbfs: " Jeff Layton
2023-09-28 11:02   ` [PATCH 45/87] fs/isofs: " Jeff Layton
2023-09-28 11:02   ` [PATCH 46/87] fs/jffs2: " Jeff Layton
2023-09-28 11:02   ` [PATCH 47/87] fs/jfs: " Jeff Layton
2023-10-03 16:33     ` [Jfs-discussion] [PATCH 47/87] fs/jfs: convert to new inode {a, m}time accessors Dave Kleikamp
2023-09-28 11:02   ` [PATCH 48/87] fs/kernfs: convert to new inode {a,m}time accessors Jeff Layton
2023-09-28 11:02   ` [PATCH 49/87] fs/minix: " Jeff Layton
2023-09-28 11:02   ` [PATCH 50/87] fs/nfs: " Jeff Layton
2023-09-28 11:03   ` [PATCH 51/87] fs/nfsd: " Jeff Layton
2023-09-28 13:56     ` Chuck Lever
2023-09-28 14:09       ` Jeff Layton
2023-09-28 14:33         ` Chuck Lever
2023-09-28 11:03   ` [PATCH 52/87] fs/nilfs2: " Jeff Layton
2023-09-28 11:03   ` [PATCH 53/87] fs/ntfs: " Jeff Layton
2023-09-28 11:03   ` [PATCH 54/87] fs/ntfs3: " Jeff Layton
2023-09-28 11:03   ` [PATCH 55/87] fs/ocfs2: " Jeff Layton
2023-09-28 11:03   ` [PATCH 56/87] fs/omfs: " Jeff Layton
2023-09-28 11:03   ` [PATCH 57/87] fs/openpromfs: " Jeff Layton
2023-09-28 11:03   ` [PATCH 58/87] fs/orangefs: " Jeff Layton
2023-09-28 11:03   ` [PATCH 59/87] fs/overlayfs: " Jeff Layton
2023-09-28 11:03   ` [PATCH 60/87] fs/proc: " Jeff Layton
2023-09-28 11:03   ` [PATCH 61/87] fs/pstore: " Jeff Layton
2023-09-28 11:03   ` [PATCH 62/87] fs/qnx4: " Jeff Layton
2023-09-28 12:41     ` Anders Larsen
2023-09-28 11:03   ` [PATCH 63/87] fs/qnx6: " Jeff Layton
2023-09-28 11:03   ` [PATCH 64/87] fs/ramfs: " Jeff Layton
2023-09-28 11:03   ` [PATCH 65/87] fs/reiserfs: " Jeff Layton
2023-09-28 11:03   ` [PATCH 66/87] fs/romfs: " Jeff Layton
2023-09-28 11:03   ` [PATCH 67/87] fs/smb/client: " Jeff Layton
2023-09-28 11:03   ` [PATCH 68/87] fs/smb/server: " Jeff Layton
2023-09-28 11:03   ` [PATCH 69/87] fs/squashfs: " Jeff Layton
2023-09-28 11:03   ` [PATCH 70/87] fs/sysv: " Jeff Layton
2023-09-28 11:03   ` [PATCH 71/87] fs/tracefs: " Jeff Layton
2023-09-28 11:03   ` [PATCH 72/87] fs/ubifs: " Jeff Layton
2023-09-28 11:03   ` [PATCH 73/87] fs/udf: " Jeff Layton
2023-09-28 11:03   ` [PATCH 74/87] fs/ufs: " Jeff Layton
2023-09-28 11:03   ` [PATCH 75/87] fs/vboxsf: " Jeff Layton
2023-09-28 11:03   ` [PATCH 76/87] fs/xfs: " Jeff Layton
2023-09-28 11:03   ` [PATCH 77/87] fs/zonefs: " Jeff Layton
2023-09-28 11:03   ` [PATCH 78/87] ipc: " Jeff Layton
2023-09-28 11:03   ` [PATCH 79/87] kernel/bpf: " Jeff Layton
2023-09-28 11:03   ` [PATCH 80/87] mm: " Jeff Layton
2023-09-28 11:03   ` [PATCH 81/87] net/sunrpc: " Jeff Layton
2023-09-28 11:03   ` [PATCH 82/87] security/apparmor: " Jeff Layton
2023-09-28 11:03   ` [PATCH 83/87] security/selinux: " Jeff Layton
2023-10-03 19:53     ` Paul Moore
2023-09-28 11:03   ` [PATCH 84/87] security: " Jeff Layton
2023-10-03 23:41     ` Paul Moore
2023-09-28 11:03 ` [PATCH 01/87] fs: new accessor methods for atime and mtime Jeff Layton

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=20230928110413.33032-32-jlayton@kernel.org \
    --to=jlayton@kernel.org \
    --cc=brauner@kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --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).