[PATCH v3 0/9] fs: multigrain timestamp redux

2024-07-05 Thread Jeff Layton
tl;dr for those who have been following along: There are several changes in this version. The conversion of ctime to be a ktime_t value has been dropped, and we now use an unused bit in the nsec field as the QUERIED flag (like the earlier patchset did). The floor value is now tracked as a monoton

[PATCH v3 1/9] fs: add infrastructure for multigrain timestamps

2024-07-05 Thread Jeff Layton
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

[PATCH v3 2/9] fs: tracepoints around multigrain timestamp events

2024-07-05 Thread Jeff Layton
Add some tracepoints around various multigrain timestamp events. Signed-off-by: Jeff Layton --- fs/inode.c | 5 ++ fs/stat.c| 3 ++ include/trace/events/timestamp.h | 109 +++ 3 files changed, 117 insertions(+)

[PATCH v3 3/9] fs: add percpu counters to count fine vs. coarse timestamps

2024-07-05 Thread Jeff Layton
Keep a pair of percpu counters so we can track what proportion of timestamps is fine-grained. Signed-off-by: Jeff Layton --- fs/inode.c | 49 - 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/fs/inode.c b/fs/inode.c index 4ab7aee3558c

[PATCH v3 4/9] fs: have setattr_copy handle multigrain timestamps appropriately

2024-07-05 Thread Jeff Layton
The setattr codepath is still using coarse-grained timestamps, even on multigrain filesystems. To fix this, we need to fetch the timestamp for ctime updates later, at the point where the assignment occurs in setattr_copy. On a multigrain inode, ignore the ia_ctime in the attrs, and always update t

[PATCH v3 5/9] Documentation: add a new file documenting multigrain timestamps

2024-07-05 Thread Jeff Layton
Add a high-level document that describes how multigrain timestamps work, rationale for them, and some info about implementation and tradeoffs. Signed-off-by: Jeff Layton --- Documentation/filesystems/multigrain-ts.rst | 120 1 file changed, 120 insertions(+) diff --

[PATCH v3 6/9] xfs: switch to multigrain timestamps

2024-07-05 Thread Jeff Layton
Enable multigrain timestamps, which should ensure that there is an apparent change to the timestamp whenever it has been written after being actively observed via getattr. Also, anytime the mtime changes, the ctime must also change, and those are now the only two options for xfs_trans_ichgtime. Ha

[PATCH v3 7/9] ext4: switch to multigrain timestamps

2024-07-05 Thread Jeff Layton
Enable multigrain timestamps, which should ensure that there is an apparent change to the timestamp whenever it has been written after being actively observed via getattr. For ext4, we only need to enable the FS_MGTIME flag. Signed-off-by: Jeff Layton --- fs/ext4/super.c | 2 +- 1 file changed,

[PATCH v3 8/9] btrfs: convert to multigrain timestamps

2024-07-05 Thread Jeff Layton
Enable multigrain timestamps, which should ensure that there is an apparent change to the timestamp whenever it has been written after being actively observed via getattr. Beyond enabling the FS_MGTIME flag, this patch eliminates update_time_for_write, which goes to great pains to avoid in-memory

[PATCH v3 9/9] tmpfs: add support for multigrain timestamps

2024-07-05 Thread Jeff Layton
Enable multigrain timestamps, which should ensure that there is an apparent change to the timestamp whenever it has been written after being actively observed via getattr. tmpfs only requires the FS_MGTIME flag. Signed-off-by: Jeff Layton --- mm/shmem.c | 2 +- 1 file changed, 1 insertion(+), 1

Re: [PATCH v3 2/9] fs: tracepoints around multigrain timestamp events

2024-07-05 Thread Steven Rostedt
On Fri, 05 Jul 2024 13:02:36 -0400 Jeff Layton wrote: > diff --git a/include/trace/events/timestamp.h > b/include/trace/events/timestamp.h > new file mode 100644 > index ..a004e5572673 > --- /dev/null > +++ b/include/trace/events/timestamp.h > @@ -0,0 +1,109 @@ > +/* SPDX-License-Ide

Re: [PATCH v3 2/9] fs: tracepoints around multigrain timestamp events

2024-07-05 Thread Jeff Layton
On Fri, 2024-07-05 at 14:07 -0400, Steven Rostedt wrote: > On Fri, 05 Jul 2024 13:02:36 -0400 > Jeff Layton wrote: > > > diff --git a/include/trace/events/timestamp.h > > b/include/trace/events/timestamp.h > > new file mode 100644 > > index ..a004e5572673 > > --- /dev/null > > +++ b/i

Re: [PATCH v3 5/9] Documentation: add a new file documenting multigrain timestamps

2024-07-05 Thread Randy Dunlap
On 7/5/24 10:02 AM, Jeff Layton wrote: > Add a high-level document that describes how multigrain timestamps work, > rationale for them, and some info about implementation and tradeoffs. > > Signed-off-by: Jeff Layton > --- > Documentation/filesystems/multigrain-ts.rst | 120 > +++