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: gfs2@lists.linux.dev
Subject: [PATCH v2 40/89] gfs2: convert to new timestamp accessors
Date: Wed, 4 Oct 2023 14:52:25 -0400 [thread overview]
Message-ID: <20231004185347.80880-38-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/gfs2/bmap.c | 10 +++++-----
fs/gfs2/dir.c | 10 +++++-----
fs/gfs2/glops.c | 11 ++++++-----
fs/gfs2/inode.c | 7 ++++---
fs/gfs2/quota.c | 2 +-
fs/gfs2/super.c | 12 ++++++------
6 files changed, 27 insertions(+), 25 deletions(-)
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index 47d0f39feeb1..f1d92e4d1538 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -1385,7 +1385,7 @@ static int trunc_start(struct inode *inode, u64 newsize)
ip->i_diskflags |= GFS2_DIF_TRUNC_IN_PROG;
i_size_write(inode, newsize);
- ip->i_inode.i_mtime = inode_set_ctime_current(&ip->i_inode);
+ inode_set_mtime_to_ts(&ip->i_inode, inode_set_ctime_current(&ip->i_inode));
gfs2_dinode_out(ip, dibh->b_data);
if (journaled)
@@ -1582,7 +1582,7 @@ static int sweep_bh_for_rgrps(struct gfs2_inode *ip, struct gfs2_holder *rd_gh,
/* Every transaction boundary, we rewrite the dinode
to keep its di_blocks current in case of failure. */
- ip->i_inode.i_mtime = inode_set_ctime_current(&ip->i_inode);
+ inode_set_mtime_to_ts(&ip->i_inode, inode_set_ctime_current(&ip->i_inode));
gfs2_trans_add_meta(ip->i_gl, dibh);
gfs2_dinode_out(ip, dibh->b_data);
brelse(dibh);
@@ -1948,7 +1948,7 @@ static int punch_hole(struct gfs2_inode *ip, u64 offset, u64 length)
gfs2_statfs_change(sdp, 0, +btotal, 0);
gfs2_quota_change(ip, -(s64)btotal, ip->i_inode.i_uid,
ip->i_inode.i_gid);
- ip->i_inode.i_mtime = inode_set_ctime_current(&ip->i_inode);
+ inode_set_mtime_to_ts(&ip->i_inode, inode_set_ctime_current(&ip->i_inode));
gfs2_trans_add_meta(ip->i_gl, dibh);
gfs2_dinode_out(ip, dibh->b_data);
up_write(&ip->i_rw_mutex);
@@ -1991,7 +1991,7 @@ static int trunc_end(struct gfs2_inode *ip)
gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode));
gfs2_ordered_del_inode(ip);
}
- ip->i_inode.i_mtime = inode_set_ctime_current(&ip->i_inode);
+ inode_set_mtime_to_ts(&ip->i_inode, inode_set_ctime_current(&ip->i_inode));
ip->i_diskflags &= ~GFS2_DIF_TRUNC_IN_PROG;
gfs2_trans_add_meta(ip->i_gl, dibh);
@@ -2092,7 +2092,7 @@ static int do_grow(struct inode *inode, u64 size)
goto do_end_trans;
truncate_setsize(inode, size);
- ip->i_inode.i_mtime = inode_set_ctime_current(&ip->i_inode);
+ inode_set_mtime_to_ts(&ip->i_inode, inode_set_ctime_current(&ip->i_inode));
gfs2_trans_add_meta(ip->i_gl, dibh);
gfs2_dinode_out(ip, dibh->b_data);
brelse(dibh);
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index 1a2afa88f8be..61ddd03ea111 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -130,7 +130,7 @@ static int gfs2_dir_write_stuffed(struct gfs2_inode *ip, const char *buf,
memcpy(dibh->b_data + offset + sizeof(struct gfs2_dinode), buf, size);
if (ip->i_inode.i_size < offset + size)
i_size_write(&ip->i_inode, offset + size);
- ip->i_inode.i_mtime = inode_set_ctime_current(&ip->i_inode);
+ inode_set_mtime_to_ts(&ip->i_inode, inode_set_ctime_current(&ip->i_inode));
gfs2_dinode_out(ip, dibh->b_data);
brelse(dibh);
@@ -227,7 +227,7 @@ static int gfs2_dir_write_data(struct gfs2_inode *ip, const char *buf,
if (ip->i_inode.i_size < offset + copied)
i_size_write(&ip->i_inode, offset + copied);
- ip->i_inode.i_mtime = inode_set_ctime_current(&ip->i_inode);
+ inode_set_mtime_to_ts(&ip->i_inode, inode_set_ctime_current(&ip->i_inode));
gfs2_trans_add_meta(ip->i_gl, dibh);
gfs2_dinode_out(ip, dibh->b_data);
@@ -1825,7 +1825,7 @@ int gfs2_dir_add(struct inode *inode, const struct qstr *name,
da->bh = NULL;
brelse(bh);
ip->i_entries++;
- ip->i_inode.i_mtime = tv;
+ inode_set_mtime_to_ts(&ip->i_inode, tv);
if (S_ISDIR(nip->i_inode.i_mode))
inc_nlink(&ip->i_inode);
mark_inode_dirty(inode);
@@ -1911,7 +1911,7 @@ int gfs2_dir_del(struct gfs2_inode *dip, const struct dentry *dentry)
if (!dip->i_entries)
gfs2_consist_inode(dip);
dip->i_entries--;
- dip->i_inode.i_mtime = tv;
+ inode_set_mtime_to_ts(&dip->i_inode, tv);
if (d_is_dir(dentry))
drop_nlink(&dip->i_inode);
mark_inode_dirty(&dip->i_inode);
@@ -1952,7 +1952,7 @@ int gfs2_dir_mvino(struct gfs2_inode *dip, const struct qstr *filename,
dent->de_type = cpu_to_be16(new_type);
brelse(bh);
- dip->i_inode.i_mtime = inode_set_ctime_current(&dip->i_inode);
+ inode_set_mtime_to_ts(&dip->i_inode, inode_set_ctime_current(&dip->i_inode));
mark_inode_dirty_sync(&dip->i_inode);
return 0;
}
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
index 5f845fd9f13a..b41c78bd2cc0 100644
--- a/fs/gfs2/glops.c
+++ b/fs/gfs2/glops.c
@@ -403,7 +403,7 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf)
{
struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
const struct gfs2_dinode *str = buf;
- struct timespec64 atime;
+ struct timespec64 atime, iatime;
u16 height, depth;
umode_t mode = be32_to_cpu(str->di_mode);
struct inode *inode = &ip->i_inode;
@@ -433,10 +433,11 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf)
gfs2_set_inode_blocks(inode, be64_to_cpu(str->di_blocks));
atime.tv_sec = be64_to_cpu(str->di_atime);
atime.tv_nsec = be32_to_cpu(str->di_atime_nsec);
- if (timespec64_compare(&inode->i_atime, &atime) < 0)
- inode->i_atime = atime;
- inode->i_mtime.tv_sec = be64_to_cpu(str->di_mtime);
- inode->i_mtime.tv_nsec = be32_to_cpu(str->di_mtime_nsec);
+ iatime = inode_get_atime(inode);
+ if (timespec64_compare(&iatime, &atime) < 0)
+ inode_set_atime_to_ts(inode, atime);
+ inode_set_mtime(inode, be64_to_cpu(str->di_mtime),
+ be32_to_cpu(str->di_mtime_nsec));
inode_set_ctime(inode, be64_to_cpu(str->di_ctime),
be32_to_cpu(str->di_ctime_nsec));
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 697f95047033..1547ee2f7c21 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -185,8 +185,9 @@ struct inode *gfs2_inode_lookup(struct super_block *sb, unsigned int type,
set_bit(GLF_INSTANTIATE_NEEDED, &ip->i_gl->gl_flags);
/* Lowest possible timestamp; will be overwritten in gfs2_dinode_in. */
- inode->i_atime.tv_sec = 1LL << (8 * sizeof(inode->i_atime.tv_sec) - 1);
- inode->i_atime.tv_nsec = 0;
+ inode_set_atime(inode,
+ 1LL << (8 * sizeof(inode_get_atime_sec(inode)) - 1),
+ 0);
glock_set_object(ip->i_gl, ip);
@@ -696,7 +697,7 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
set_nlink(inode, S_ISDIR(mode) ? 2 : 1);
inode->i_rdev = dev;
inode->i_size = size;
- inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode);
+ simple_inode_init_ts(inode);
munge_mode_uid_gid(dip, inode);
check_and_update_goal(dip);
ip->i_goal = dip->i_goal;
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index ef2da4bd66c2..6affd261a754 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -910,7 +910,7 @@ static int gfs2_adjust_quota(struct gfs2_sbd *sdp, loff_t loc,
size = loc + sizeof(struct gfs2_quota);
if (size > inode->i_size)
i_size_write(inode, size);
- inode->i_mtime = inode_set_ctime_current(inode);
+ inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode));
mark_inode_dirty(inode);
set_bit(QDF_REFRESH, &qd->qd_flags);
}
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index dd2720a5ca62..a96e37dc0d73 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -410,9 +410,9 @@ void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf)
str->di_nlink = cpu_to_be32(inode->i_nlink);
str->di_size = cpu_to_be64(i_size_read(inode));
str->di_blocks = cpu_to_be64(gfs2_get_inode_blocks(inode));
- str->di_atime = cpu_to_be64(inode->i_atime.tv_sec);
- str->di_mtime = cpu_to_be64(inode->i_mtime.tv_sec);
- str->di_ctime = cpu_to_be64(inode_get_ctime(inode).tv_sec);
+ str->di_atime = cpu_to_be64(inode_get_atime_sec(inode));
+ str->di_mtime = cpu_to_be64(inode_get_mtime_sec(inode));
+ str->di_ctime = cpu_to_be64(inode_get_ctime_sec(inode));
str->di_goal_meta = cpu_to_be64(ip->i_goal);
str->di_goal_data = cpu_to_be64(ip->i_goal);
@@ -427,9 +427,9 @@ void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf)
str->di_entries = cpu_to_be32(ip->i_entries);
str->di_eattr = cpu_to_be64(ip->i_eattr);
- str->di_atime_nsec = cpu_to_be32(inode->i_atime.tv_nsec);
- str->di_mtime_nsec = cpu_to_be32(inode->i_mtime.tv_nsec);
- str->di_ctime_nsec = cpu_to_be32(inode_get_ctime(inode).tv_nsec);
+ str->di_atime_nsec = cpu_to_be32(inode_get_atime_nsec(inode));
+ str->di_mtime_nsec = cpu_to_be32(inode_get_mtime_nsec(inode));
+ str->di_ctime_nsec = cpu_to_be32(inode_get_ctime_nsec(inode));
}
/**
--
2.41.0
next prev parent reply other threads:[~2023-10-04 18:56 UTC|newest]
Thread overview: 92+ 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:51 ` [PATCH v2 03/89] spufs: convert to new timestamp accessors 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 ` [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 ` [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 ` Jeff Layton [this message]
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 ` [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 ` [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 ` [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 ` [PATCH v2 02/89] fs: convert core infrastructure to new timestamp accessors Jeff Layton
2023-10-09 16:09 ` [PATCH v2 00/89] fs: new accessor methods for inode atime and mtime 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-38-jlayton@kernel.org \
--to=jlayton@kernel.org \
--cc=brauner@kernel.org \
--cc=gfs2@lists.linux.dev \
--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