[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230518114742.128950-9-jlayton@kernel.org>
Date: Thu, 18 May 2023 07:47:41 -0400
From: Jeff Layton <jlayton@...nel.org>
To: Alexander Viro <viro@...iv.linux.org.uk>,
Christian Brauner <brauner@...nel.org>,
"Darrick J. Wong" <djwong@...nel.org>,
Hugh Dickins <hughd@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Dave Chinner <david@...morbit.com>,
Chuck Lever <chuck.lever@...cle.com>
Cc: Jan Kara <jack@...e.cz>, Amir Goldstein <amir73il@...il.com>,
David Howells <dhowells@...hat.com>,
Neil Brown <neilb@...e.de>,
Matthew Wilcox <willy@...radead.org>,
Andreas Dilger <adilger.kernel@...ger.ca>,
Theodore T'so <tytso@....edu>, Chris Mason <clm@...com>,
Josef Bacik <josef@...icpanda.com>,
David Sterba <dsterba@...e.com>,
Namjae Jeon <linkinjeon@...nel.org>,
Steve French <sfrench@...ba.org>,
Sergey Senozhatsky <senozhatsky@...omium.org>,
Tom Talpey <tom@...pey.com>, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-xfs@...r.kernel.org,
linux-btrfs@...r.kernel.org, linux-ext4@...r.kernel.org,
linux-mm@...ck.org, linux-nfs@...r.kernel.org,
linux-cifs@...r.kernel.org
Subject: [PATCH v4 8/9] ext4: convert to multigrain timestamps
Signed-off-by: Jeff Layton <jlayton@...nel.org>
---
fs/ext4/inode.c | 17 +++++++++++++++--
fs/ext4/super.c | 2 +-
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index e0bbcf7a07b5..37840aeb7ff9 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -4235,6 +4235,19 @@ static int ext4_inode_blocks_set(struct ext4_inode *raw_inode,
return 0;
}
+static void ext4_inode_set_ctime(struct inode *inode, struct ext4_inode *raw_inode)
+{
+ struct timespec64 ctime = ctime_peek(inode);
+
+ if (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), i_ctime_extra)) {
+ raw_inode->i_ctime = cpu_to_le32(ctime.tv_sec);
+ raw_inode->i_ctime_extra = ext4_encode_extra_time(&ctime);
+ } else {
+ raw_inode->i_ctime = cpu_to_le32(clamp_t(int32_t,
+ ctime.tv_sec, S32_MIN, S32_MAX));
+ }
+}
+
static int ext4_fill_raw_inode(struct inode *inode, struct ext4_inode *raw_inode)
{
struct ext4_inode_info *ei = EXT4_I(inode);
@@ -4275,7 +4288,7 @@ static int ext4_fill_raw_inode(struct inode *inode, struct ext4_inode *raw_inode
}
raw_inode->i_links_count = cpu_to_le16(inode->i_nlink);
- EXT4_INODE_SET_XTIME(i_ctime, inode, raw_inode);
+ ext4_inode_set_ctime(inode, raw_inode);
EXT4_INODE_SET_XTIME(i_mtime, inode, raw_inode);
EXT4_INODE_SET_XTIME(i_atime, inode, raw_inode);
EXT4_EINODE_SET_XTIME(i_crtime, ei, raw_inode);
@@ -4983,7 +4996,7 @@ static void __ext4_update_other_inode_time(struct super_block *sb,
spin_unlock(&inode->i_lock);
spin_lock(&ei->i_raw_lock);
- EXT4_INODE_SET_XTIME(i_ctime, inode, raw_inode);
+ ext4_inode_set_ctime(inode, raw_inode);
EXT4_INODE_SET_XTIME(i_mtime, inode, raw_inode);
EXT4_INODE_SET_XTIME(i_atime, inode, raw_inode);
ext4_inode_csum_set(inode, raw_inode, ei);
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 9680fe753e59..4de4977dcb21 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -7258,7 +7258,7 @@ static struct file_system_type ext4_fs_type = {
.init_fs_context = ext4_init_fs_context,
.parameters = ext4_param_specs,
.kill_sb = kill_block_super,
- .fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP,
+ .fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP | FS_MULTIGRAIN_TS,
};
MODULE_ALIAS_FS("ext4");
--
2.40.1
Powered by blists - more mailing lists