mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 12:11:40 +00:00
6ac81fd55e
-----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQRAhzRXHqcMeLMyaSiRxhvAZXjcogUCZzcScQAKCRCRxhvAZXjc oj+5AP4k822a77wc/3iPFk379naIvQ4dsrgemh0/Pb6ZvzvkFQEAi3vFCfzCDR2x SkJF/RwXXKZv6U31QXMRt2Qo6wfBuAc= =nVlm -----END PGP SIGNATURE----- Merge tag 'vfs-6.13.mgtime' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs Pull vfs multigrain timestamps from Christian Brauner: "This is another try at implementing multigrain timestamps. This time with significant help from the timekeeping maintainers to reduce the performance impact. Thomas provided a base branch that contains the required timekeeping interfaces for the VFS. It serves as the base for the multi-grain timestamp work: - Multigrain timestamps allow the kernel to use fine-grained timestamps when an inode's attributes is being actively observed via ->getattr(). With this support, it's possible for a file to get a fine-grained timestamp, and another modified after it to get a coarse-grained stamp that is earlier than the fine-grained time. If this happens then the files can appear to have been modified in reverse order, which breaks VFS ordering guarantees. To prevent this, a floor value is maintained for multigrain timestamps. Whenever a fine-grained timestamp is handed out, record it, and when later coarse-grained stamps are handed out, ensure they are not earlier than that value. If the coarse-grained timestamp is earlier than the fine-grained floor, return the floor value instead. The timekeeper changes add a static singleton atomic64_t into timekeeper.c that is used to keep track of the latest fine-grained time ever handed out. This is tracked as a monotonic ktime_t value to ensure that it isn't affected by clock jumps. Because it is updated at different times than the rest of the timekeeper object, the floor value is managed independently of the timekeeper via a cmpxchg() operation, and sits on its own cacheline. Two new public timekeeper interfaces are added: (1) ktime_get_coarse_real_ts64_mg() fills a timespec64 with the later of the coarse-grained clock and the floor time (2) ktime_get_real_ts64_mg() gets the fine-grained clock value, and tries to swap it into the floor. A timespec64 is filled with the result. - The VFS has always used coarse-grained timestamps when updating the ctime and mtime after a change. This has the benefit of allowing filesystems to optimize away a lot metadata updates, down to around 1 per jiffy, even when a file is under heavy writes. Unfortunately, this has always been an issue when we're exporting via NFSv3, which relies on timestamps to validate caches. A lot of changes can happen in a jiffy, so timestamps aren't sufficient to help the client decide when to invalidate the cache. Even with NFSv4, a lot of exported filesystems don't properly support a change attribute and are subject to the same problems with timestamp granularity. Other applications have similar issues with timestamps (e.g backup applications). If we were to always use fine-grained timestamps, that would improve the situation, but that becomes rather expensive, as the underlying filesystem would have to log a lot more metadata updates. This adds a way to only use fine-grained timestamps when they are being actively queried. Use the (unused) top bit in inode->i_ctime_nsec as a flag that indicates whether the current timestamps have been queried via stat() or the like. When it's set, we allow the kernel to use a fine-grained timestamp iff it's necessary to make the ctime show a different value. This solves the problem of being able to distinguish the timestamp between updates, but introduces a new problem: it's now possible for a file being changed to get a fine-grained timestamp. A file that is altered just a bit later can then get a coarse-grained one that appears older than the earlier fine-grained time. This violates timestamp ordering guarantees. This is where the earlier mentioned timkeeping interfaces help. A global monotonic atomic64_t value is kept that acts as a timestamp floor. When we go to stamp a file, we first get the latter of the current floor value and the current coarse-grained time. If the inode ctime hasn't been queried then we just attempt to stamp it with that value. If it has been queried, then first see whether the current coarse time is later than the existing ctime. If it is, then we accept that value. If it isn't, then we get a fine-grained time and try to swap that into the global floor. Whether that succeeds or fails, we take the resulting floor time, convert it to realtime and try to swap that into the ctime. We take the result of the ctime swap whether it succeeds or fails, since either is just as valid. Filesystems can opt into this by setting the FS_MGTIME fstype flag. Others should be unaffected (other than being subject to the same floor value as multigrain filesystems)" * tag 'vfs-6.13.mgtime' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs: fs: reduce pointer chasing in is_mgtime() test tmpfs: add support for multigrain timestamps btrfs: convert to multigrain timestamps ext4: switch to multigrain timestamps xfs: switch to multigrain timestamps Documentation: add a new file documenting multigrain timestamps fs: add percpu counters for significant multigrain timestamp events fs: tracepoints around multigrain timestamp events fs: handle delegated timestamps in setattr_copy_mgtime timekeeping: Add percpu counter for tracking floor swap events timekeeping: Add interfaces for handling timestamps with a floor value fs: have setattr_copy handle multigrain timestamps appropriately fs: add infrastructure for multigrain timestamps |
||
---|---|---|
.. | ||
xfs_ag_resv.c | ||
xfs_ag_resv.h | ||
xfs_ag.c | ||
xfs_ag.h | ||
xfs_alloc_btree.c | ||
xfs_alloc_btree.h | ||
xfs_alloc.c | ||
xfs_alloc.h | ||
xfs_attr_leaf.c | ||
xfs_attr_leaf.h | ||
xfs_attr_remote.c | ||
xfs_attr_remote.h | ||
xfs_attr_sf.h | ||
xfs_attr.c | ||
xfs_attr.h | ||
xfs_bit.c | ||
xfs_bit.h | ||
xfs_bmap_btree.c | ||
xfs_bmap_btree.h | ||
xfs_bmap.c | ||
xfs_bmap.h | ||
xfs_btree_mem.c | ||
xfs_btree_mem.h | ||
xfs_btree_staging.c | ||
xfs_btree_staging.h | ||
xfs_btree.c | ||
xfs_btree.h | ||
xfs_cksum.h | ||
xfs_da_btree.c | ||
xfs_da_btree.h | ||
xfs_da_format.h | ||
xfs_defer.c | ||
xfs_defer.h | ||
xfs_dir2_block.c | ||
xfs_dir2_data.c | ||
xfs_dir2_leaf.c | ||
xfs_dir2_node.c | ||
xfs_dir2_priv.h | ||
xfs_dir2_sf.c | ||
xfs_dir2.c | ||
xfs_dir2.h | ||
xfs_dquot_buf.c | ||
xfs_errortag.h | ||
xfs_exchmaps.c | ||
xfs_exchmaps.h | ||
xfs_format.h | ||
xfs_fs.h | ||
xfs_health.h | ||
xfs_ialloc_btree.c | ||
xfs_ialloc_btree.h | ||
xfs_ialloc.c | ||
xfs_ialloc.h | ||
xfs_iext_tree.c | ||
xfs_inode_buf.c | ||
xfs_inode_buf.h | ||
xfs_inode_fork.c | ||
xfs_inode_fork.h | ||
xfs_inode_util.c | ||
xfs_inode_util.h | ||
xfs_log_format.h | ||
xfs_log_recover.h | ||
xfs_log_rlimit.c | ||
xfs_ondisk.h | ||
xfs_parent.c | ||
xfs_parent.h | ||
xfs_quota_defs.h | ||
xfs_refcount_btree.c | ||
xfs_refcount_btree.h | ||
xfs_refcount.c | ||
xfs_refcount.h | ||
xfs_rmap_btree.c | ||
xfs_rmap_btree.h | ||
xfs_rmap.c | ||
xfs_rmap.h | ||
xfs_rtbitmap.c | ||
xfs_rtbitmap.h | ||
xfs_sb.c | ||
xfs_sb.h | ||
xfs_shared.h | ||
xfs_symlink_remote.c | ||
xfs_symlink_remote.h | ||
xfs_trans_inode.c | ||
xfs_trans_resv.c | ||
xfs_trans_resv.h | ||
xfs_trans_space.c | ||
xfs_trans_space.h | ||
xfs_types.c | ||
xfs_types.h |