Re: [PATCH RFC 2/9] timekeeping: new interfaces for multigrain timestamp handing

From: Jan Kara
Date: Wed Nov 01 2023 - 06:16:58 EST


On Wed 01-11-23 08:57:09, Dave Chinner wrote:
> 5. When-ever the inode is persisted, the timestamp is copied to the
> on-disk structure and the current change counter is folded in.
>
> This means the on-disk structure always contains the latest
> change attribute that has been persisted, just like we
> currently do with i_version now.
>
> 6. When-ever we read the inode off disk, we split the change counter
> from the timestamp and update the appropriate internal structures
> with this information.
>
> This ensures that the VFS and userspace never see the change
> counter implementation in the inode timestamps.

OK, but is this compatible with the current XFS behavior? AFAICS currently
XFS sets sb->s_time_gran to 1 so timestamps currently stored on disk will
have some mostly random garbage in low bits of the ctime. Now if you look
at such inode with a kernel using this new scheme, stat(2) will report
ctime with low bits zeroed-out so if the ctime fetched in the old kernel was
stored in some external database and compared to the newly fetched ctime, it
will appear that ctime has gone backwards... Maybe we don't care but it is
a user visible change that can potentially confuse something.

Honza
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR