[PATCH 2/2] rpdfs: Set the inode creation time
Valerie Aurora <[email protected]> Tue, 10 Mar 2026 18:31:40 +0100
| Newsgroups | dev.linux.lists.rpdfs-devel |
|---|---|
| Message-ID | <[email protected]> |
Setting inode creation time is slightly trickier than a/m/ctime because it's not tracked in the VFS inode. Add a function to set creation time at inode creation time. Signed-off-by: Valerie Aurora <[email protected]> --- fs/rpdfs/dir.c | 3 +++ fs/rpdfs/inode.c | 17 +++++++++++++++++ fs/rpdfs/inode.h | 2 ++ 3 files changed, 22 insertions(+) diff --git a/fs/rpdfs/dir.c b/fs/rpdfs/dir.c index 7d51c133cba0..71524e3f2839 100644 --- a/fs/rpdfs/dir.c +++ b/fs/rpdfs/dir.c @@ -468,6 +468,9 @@ static struct inode *create_new_inode(struct mnt_idmap *idmap, struct inode *dir apply_add_entry(rfi, &txn, dir, kd); } + /* creation time is not tracked in the vfs inode so do it by hand */ + rpdfs_inode_crtime_set(rfi, &txn, inode, inode_get_atime(inode)); + /* sync changes to vfs inodes with inode blocks */ rpdfs_inode_txn_update(rfi, &txn, dir); rpdfs_inode_txn_update(rfi, &txn, inode); diff --git a/fs/rpdfs/inode.c b/fs/rpdfs/inode.c index bdd31ce0b6da..4d24fa00512c 100644 --- a/fs/rpdfs/inode.c +++ b/fs/rpdfs/inode.c @@ -359,6 +359,23 @@ void rpdfs_inode_txn_update(struct rpdfs_fs_info *rfi, struct rpdfs_transaction ri->refresh_wcount = hnd->wcount; } +/* + * Set the inode creation time. + */ +void rpdfs_inode_crtime_set(struct rpdfs_fs_info *rfi, struct rpdfs_transaction *txn, + struct inode *inode, struct timespec64 ts) +{ + struct rpdfs_block_handle *hnd = NULL; + struct rpdfs_inode *rinode; + int ret; + + ret = rpdfs_txn_use_prepared(rfi, txn, rpdfs_inode_bnr(inode), &hnd, RBAF_WRITE); + BUG_ON(ret < 0); /* caller must have prepared */ + + rinode = hnd->data; + rinode->crtime_nsec = cpu_ts64_to_le64_ns(ts); +} + /* * Start writing a previously dirtied vfs inode. * diff --git a/fs/rpdfs/inode.h b/fs/rpdfs/inode.h index 6b0fddb7f0fb..3ca3d248e338 100644 --- a/fs/rpdfs/inode.h +++ b/fs/rpdfs/inode.h @@ -69,6 +69,8 @@ int rpdfs_inode_txn_prepare(struct rpdfs_fs_info *rfi, struct rpdfs_transaction struct inode *inode, rbaf_t rbaf); void rpdfs_inode_txn_update(struct rpdfs_fs_info *rfi, struct rpdfs_transaction *txn, struct inode *inode); +void rpdfs_inode_crtime_set(struct rpdfs_fs_info *rfi, struct rpdfs_transaction *txn, + struct inode *inode, struct timespec64 ts); int rpdfs_inode_init(void); void rpdfs_inode_exit(void); -- 2.49.0