Skip to content

RFC Allow setting file birth time with utimensat()

Omar Sandoval linux-api linux-btrfs linux-ext4 linux-f2fs-devel linux-fsdevel linux-xfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest6 patches 19 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6fs: add btime to struct iattrfs/attr.c include/linux/fs.h+10 -00 replies
2/6fs: add AT_UTIME_BTIME for utimensat()fs/utimes.c include/uapi/linux/fcntl.h+55 -330 replies
3/6Btrfs: add support for setting btimefs/btrfs/inode.c fs/btrfs/super.c+4 -20 replies
4/6ext4: add support for setting btimefs/ext4/inode.c fs/ext4/super.c+14 -30 replies
5/6f2fs: add support for setting btimefs/f2fs/file.c fs/f2fs/super.c+16 -50 replies
6/6xfs: add support for setting btimefs/xfs/libxfs/xfs_format.h fs/xfs/libxfs/xfs_log_format.h fs/xfs/xfs_iops.c +1 more+12 -50 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/6] Allow setting file birth time with utimensat()

From: Omar Sandoval <[email protected]>

Hi,

Since statx was added in 4.11, userspace has had an interface for reading btime (file creation time), but no way to set it. This RFC patch series adds support for changing btime with utimensat(). Patch 1 adds the VFS infrastructure, patch 2 adds the support to utimensat() with a new flag, and the rest of the patches add filesystem support; I excluded CIFS for now because I don't have a CIFS setup to test it on.

Updating btime is useful for at least a couple of use cases:

- Backup/restore programs (my motivation for this feature is btrfs send)
- File servers which interoperate with operating systems that allow updating file creation time, including Mac OS [1] and Windows [2]

I've also included a man page patch, xfs_io support, and an xfstest.

Thoughts on the implementation or the interface?

Thanks!

1: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setattrlist.2.html
2: https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-setfiletime

Omar Sandoval (6):
fs: add btime to struct iattr
fs: add AT_UTIME_BTIME for utimensat()
Btrfs: add support for setting btime
ext4: add support for setting btime
f2fs: add support for setting btime
xfs: add support for setting btime

 fs/attr.c                      |  6 +++
 fs/btrfs/inode.c               |  2 +
 fs/btrfs/super.c               |  4 +-
 fs/ext4/inode.c                | 15 +++++-
 fs/ext4/super.c                |  2 +-
 fs/f2fs/file.c                 | 19 ++++++--
 fs/f2fs/super.c                |  2 +-
 fs/utimes.c                    | 86 +++++++++++++++++++++-------------
 fs/xfs/libxfs/xfs_format.h     |  2 +-
 fs/xfs/libxfs/xfs_log_format.h |  2 +-
 fs/xfs/xfs_iops.c              | 11 ++++-
 fs/xfs/xfs_super.c             |  2 +-
 include/linux/fs.h             |  4 ++
 include/uapi/linux/fcntl.h     |  2 +
 14 files changed, 111 insertions(+), 48 deletions(-)
Signature · 1 line
2.20.1