Multi-Grain Timestamps Revived For Linux File-Systems

Written by Michael Larabel in Linux Storage on 27 June 2024 at 05:45 AM EDT. 7 Comments
LINUX STORAGE
Last year a new kernel feature merged in Linux 6.6 was multi-grain(ed) timestamps for file-systems as a means of better timestamp handling originally for NFS compared to the existing coarse-grained timestamps with the once per jiffy timestamps being used for invalidating NFS caches. But multi-grain timestamps was reverted just weeks after landing in the mainline kernel due to corner cases like a newer file with a coarse-grained timestamp appearing earlier than another file with a fine-grained timestamp. Due to subtle bugs like that, multi-grain timestamps were dropped before Linux 6.6 was even released while now there is a revised attempt.

Jeff Layton has sent out a new patch series aiming to revive multi-grain timestamps for Linux file-systems while addressing the earlier design issues. Layton explained in the new patch series of this multi-grain timestamp revival:
"At LSF/MM this year, we had a discussion about the inode change attribute. At the time I mentioned that I thought I could salvage the multigrain timestamp work that had to be reverted last year. That version had to be reverted because it was possible for a file to get a coarse grained timestamp that appeared to be earlier than another file that had recently gotten a fine-grained stamp.

This version corrects the problem by establishing a global ctime_floor value that should prevent this from occurring. In the above situation that was problematic before, the two files might end up with the same timestamp value, but they won't appear to have been modified in the wrong order.

That problem was discovered by the test-stat-time gnulib test. Note that that test still fails on multigrain timestamps, but that's because its method of determining the minimum delay that will show a timestamp change will no longer work with multigrain timestamps. I have a patch to change the testcase to use a different method that I will post soon.

The big question with this set is whether the performance will be suitable. The testing I've done seems to show performance parity with multigrain timestamps enabled, but it's hard to rule this out regressing some workload.

This set is based on top of Christian's vfs.misc branch (which has the earlier change to track inode timestamps as discrete integers). If there are no major objections, I'd like to let this soak in linux-next for a bit to see if any problems shake out."

We'll see how the attempt goes this time if multi-grain timestamps can be safely reintroduced to the mainline kernel.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week