fs: drop the timespec64 arg from generic_update_time
authorJeff Layton <jlayton@kernel.org>
Mon, 7 Aug 2023 19:38:34 +0000 (15:38 -0400)
committerChristian Brauner <brauner@kernel.org>
Wed, 9 Aug 2023 06:56:37 +0000 (08:56 +0200)
commit541d4c798a598854fcce7326d947cbcbd35701d6
tree26703c5d9b35218747b417efd69d77459a159a87
parent0d72b92883c651a11059d93335f33d65c6eb653b
fs: drop the timespec64 arg from generic_update_time

In future patches we're going to change how the ctime is updated
to keep track of when it has been queried. The way that the update_time
operation works (and a lot of its callers) make this difficult, since
they grab a timestamp early and then pass it down to eventually be
copied into the inode.

All of the existing update_time callers pass in the result of
current_time() in some fashion. Drop the "time" parameter from
generic_update_time, and rework it to fetch its own timestamp.

This change means that an update_time could fetch a different timestamp
than was seen in inode_needs_update_time. update_time is only ever
called with one of two flag combinations: Either S_ATIME is set, or
S_MTIME|S_CTIME|S_VERSION are set.

With this change we now treat the flags argument as an indicator that
some value needed to be updated when last checked, rather than an
indication to update specific timestamps.

Rework the logic for updating the timestamps and put it in a new
inode_update_timestamps helper that other update_time routines can use.
S_ATIME is as treated as we always have, but if any of the other three
are set, then we attempt to update all three.

Also, some callers of generic_update_time need to know what timestamps
were actually updated. Change it to return an S_* flag mask to indicate
that and rework the callers to expect it.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Message-Id: <20230807-mgctime-v7-3-d1dec143a704@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/gfs2/inode.c
fs/inode.c
fs/orangefs/inode.c
fs/ubifs/file.c
fs/xfs/xfs_iops.c
include/linux/fs.h