Re: [RFC PATCH v2 1/2] vfs: add provenance time (ptime)
From: Amir Goldstein
Date: Sat Oct 31 2026 - 10:19:10 EST
On Thu, Oct 29, 2026 at 12:53 PM Amir Goldstein <amir73il@xxxxxxxxx> wrote:
>
> On Wed, Oct 28, 2026 at 02:56:39PM +0000, Pedro Falcato wrote:
> > On Wed, Oct 28, 2026 at 02:47:27PM +0100, koraynilay wrote:
> > > Add provenance time (ptime), indicating the time when a file or
> > > directory was created. This is user-settable via file_setattr() and
> > > retrievable via statx(2) (using STATX_PTIME) or file_getattr().
> > >
> > > The semantics of when to preserve this new timestamp are the same as
> > > mtime, the idea being that there is a correspondence like this:
> > >
> > > ctime <-> btime
> > > mtime <-> ptime
> > >
> > > so every operation (copying, moving, ...) that currently preserves mtime
> > > should also preserve ptime.
> > >
> > > Furthermore, in order to avoid the legacy FS_IOC_FSSETXATTR accepting
> > > FS_XFLAG_PTIME, add an FS_FILE_ATTR_XFLAGS_MASK mask to support new
> > > xflags, and use it in fileattr_to_file_attr()/file_attr_to_fileattr() to
> > > allow ptime to be used with the file_setattr()/file_getattr() syscalls.
> >
> > Random comment, but: could this be doable with xattrs instead? I'm not sure
> > where I would put the xattrs code (if in userspace exclusively, or if hooking
> > the VFS up with this, or if doing it on the filesystem side), but it would
> > surely be less disruptive than modifying a bunch of filesystems one-by-one.
> >
> > This patch is quite simple, but changing btrfs, then ext4, xfs, etc is a
> > mess, and inevitably you can't get these timestamps until you upgrade your
> > filesystems.
> >
>
> I disagree.
>
> I think that creation time should be a first class property in
> filesystems that support it.
>
One of the reasons that I think this API is a good match for the Windows
style creation time is that it was already discussed as an API for the
Windows style DOS attributes [1].
koraynilay,
In your next posting, I suggest that you first demonstrate how the proposed
API is used to facilitate filesystems that already support a user-settable
creation time (smb, ntfs,vfat,exfat), before adding btrfs support.
Thanks,
Amir.
[1] https://lore.kernel.org/linux-fsdevel/20241227121508.nofy6bho66pc5ry5@pali/