[PATCH v8 0/5] fs: multigrain timestamps for XFS's change_cookie

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



My initial goal was to implement multigrain timestamps on most major
filesystems, so we could present them to userland, and use them for
NFSv3, etc.

With the current implementation however, we can't guarantee that a file
with a coarse grained timestamp modified after one with a fine grained
timestamp will always appear to have a later value. This could confuse
some programs like make, rsync, find, etc. that depend on strict
ordering requirements for timestamps.

The goal of this version is more modest: fix XFS' change attribute.
XFS's change attribute is bumped on atime updates in addition to other
deliberate changes. This makes it unsuitable for export via nfsd.

Jan Kara suggested keeping this functionality internal-only for now and
plumbing the fine grained timestamps through getattr [1]. This set takes
a slightly different approach and has XFS use the fine-grained attr to
fake up STATX_CHANGE_COOKIE in its getattr routine itself.

While we keep fine-grained timestamps in struct inode, when presenting
the timestamps via getattr, we truncate them at a granularity of number
of ns per jiffy, which allows us to smooth over the fuzz that causes
ordering problems.

This set only converts XFS to use this scheme. All of the other
commonly-exported local filesystems have a native change attribute and
wouldn't clearly benefit from mgtime support at this time. Still, it
should be possible to add this support to other filesystems in the
future, as the need arises (bcachefs?).

I'd like to see this go in for v6.7 if possible, so getting it into
linux-next now would be great if there are no objections.

[1]: https://lore.kernel.org/linux-fsdevel/20230920124823.ghl6crb5sh4x2pmt@quack3/

Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>
---
Jeff Layton (5):
      fs: add infrastructure for multigrain timestamps
      fs: optimize away some fine-grained timestamp updates
      fs: have setattr_copy handle multigrain timestamps appropriately
      fs: add timestamp_truncate_to_gran helper
      xfs: switch to multigrain timestamps

 fs/attr.c                       |  52 ++++++++++++--
 fs/inode.c                      | 151 ++++++++++++++++++++++++++++++++++++----
 fs/xfs/libxfs/xfs_trans_inode.c |   6 +-
 fs/xfs/xfs_iops.c               |  26 +++++--
 fs/xfs/xfs_super.c              |   2 +-
 include/linux/fs.h              |  64 ++++++++++++++++-
 6 files changed, 269 insertions(+), 32 deletions(-)
---
base-commit: f8f2d6d669b91ea98ec8f182c22e06d3d0663e15
change-id: 20230921-ctime-5b7a628a4b95

Best regards,
-- 
Jeff Layton <jlayton@xxxxxxxxxx>




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux