Re: [PATCH 2/2] rpdfs: Set the inode creation time

Zach Brown <[email protected]> Wed, 11 Mar 2026 10:59:17 -0700
Newsgroups dev.linux.lists.rpdfs-devel
Message-ID <[email protected]>
On Tue, Mar 10, 2026 at 06:31:40PM +0100, Valerie Aurora wrote:
> +/*
> + * 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);
> +}

The pattern is that the in-memory inode (struct rpdfs_inode_info) is a
struct that has private fs stuff along with the storage for the vfs
inode.  This is the FOO_I() pattern found all over fs/*.  Refreshing the
inode updates the in-memory version from the current block, and the "txn
update" of the inode copies from memory to the block again.

So the way to do this is to have a local copy of the crtime in the
rpdfs_inode_info.  Copy it back and forth in copy_vfs_inode_to_rinode()
and vice versa.

Then in the apply phase that wants to update crtime it updates the
in-memory copy with something like:

	struct rpdfs_inode_info *ri = RPDFS_I(inode);
	ri->crtime_nsec = inode_atime_to_u64_nsec_or_whatever(inode);

This re-uses the current load from and store to the block and avoids
another block hash lookup -- which is a bunch of rcu and spinlock
barriers and will be a point of contention.

- z