Skip to contentSkip to conversation

rpdfs: Set the inode creation time

PATCH Applied Valerie Aurora 2 participants 2 messages Mar 17 – Mar 25

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rpdfs: Set the inode creation time

Setting inode creation time is slightly trickier than a/m/ctime because it's not tracked in the VFS inode. Add a field in the rpdfs private inode info to track it.

---
 fs/rpdfs/inode.c | 3 +++
 fs/rpdfs/inode.h | 3 +++
 2 files changed, 6 insertions(+)
fs/rpdfs/inode.c +3 -0
index bdd31ce0b6da..2f41706a59c2 100644
@@ -71,6 +71,7 @@ static void copy_rinode_to_vfs_inode(struct inode *inode, struct rpdfs_inode *ri
 	inode_set_atime_to_ts(inode, ns_to_timespec64(le64_to_cpu(rinode->atime_nsec)));
 	inode_set_ctime_to_ts(inode, ns_to_timespec64(le64_to_cpu(rinode->ctime_nsec)));
 	inode_set_mtime_to_ts(inode, ns_to_timespec64(le64_to_cpu(rinode->mtime_nsec)));
+	ri->crtime_nsec = rinode->crtime_nsec;
 
 	ri->dirents = rinode->dirents;
 
@@ -97,6 +98,7 @@ static void copy_vfs_inode_to_rinode(struct rpdfs_inode *rinode, struct inode *i
 	rinode->atime_nsec = cpu_ts64_to_le64_ns(inode_get_atime(inode));
 	rinode->ctime_nsec = cpu_ts64_to_le64_ns(inode_get_ctime(inode));
 	rinode->mtime_nsec = cpu_ts64_to_le64_ns(inode_get_mtime(inode));
+	rinode->crtime_nsec = ri->crtime_nsec;
 
 	rinode->dirents = ri->dirents;
 
@@ -303,6 +305,7 @@ struct inode *rpdfs_new_inode(struct super_block *sb, struct rpdfs_ino_gen *ig)
 	ts = inode_set_ctime_current(inode);
 	inode_set_mtime_to_ts(inode, ts);
 	inode_set_atime_to_ts(inode, ts);
+	ri->crtime_nsec = cpu_ts64_to_le64_ns(ts);
 
 	ret = insert_inode_locked4(inode, ig_hashval(ig), rpdfs_iget_test, ig);
 	if (ret < 0) {
fs/rpdfs/inode.h +3 -0
index 6b0fddb7f0fb..366f4b405e57 100644
@@ -18,6 +18,9 @@ struct rpdfs_inode_info {
 	/* Uniquifier to avoid xattr name hash collisions */
 	__le64 xattr_creates;
 
+	/* Creation time is not tracked in VFS inode, do it here */
+	__le64 crtime_nsec;
+
 	struct rpdfs_ino_gen ig;
 	struct rpdfs_btree_root dirents;
 	struct rpdfs_btree_root xattrs;
Signature · 1 line
2.49.0
Applied
#1 lore raw
Quoted 5 lines · Valerie Aurora

Setting inode creation time is slightly trickier than a/m/ctime because it's not tracked in the VFS inode. Add a field in the rpdfs private inode info to track it.

Applied, thanks!

This makes the rework of getattr for the new transaction scheme that much nicer, too. Cool.

- z