xfs: widen ondisk inode timestamps to deal with y2038+
Redesign the ondisk inode timestamps to be a simple unsigned 64-bit counter of nanoseconds since 14 Dec 1901 (i.e. the minimum time in the 32-bit unix time epoch). This enables us to handle dates up to 2486, which solves the y2038 problem. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Gao Xiang <hsiangkao@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
This commit is contained in:
@@ -32,6 +32,11 @@ struct xfs_icdinode {
|
||||
struct timespec64 di_crtime; /* time created */
|
||||
};
|
||||
|
||||
static inline bool xfs_icdinode_has_bigtime(const struct xfs_icdinode *icd)
|
||||
{
|
||||
return icd->di_flags2 & XFS_DIFLAG2_BIGTIME;
|
||||
}
|
||||
|
||||
/*
|
||||
* Inode location information. Stored in the inode and passed to
|
||||
* xfs_imap_to_bp() to get a buffer and dinode for a given inode.
|
||||
@@ -58,6 +63,12 @@ xfs_failaddr_t xfs_inode_validate_cowextsize(struct xfs_mount *mp,
|
||||
uint32_t cowextsize, uint16_t mode, uint16_t flags,
|
||||
uint64_t flags2);
|
||||
|
||||
struct timespec64 xfs_inode_from_disk_ts(const xfs_timestamp_t ts);
|
||||
static inline uint64_t xfs_inode_encode_bigtime(struct timespec64 tv)
|
||||
{
|
||||
return xfs_unix_to_bigtime(tv.tv_sec) * NSEC_PER_SEC + tv.tv_nsec;
|
||||
}
|
||||
|
||||
struct timespec64 xfs_inode_from_disk_ts(struct xfs_dinode *dip,
|
||||
const xfs_timestamp_t ts);
|
||||
|
||||
#endif /* __XFS_INODE_BUF_H__ */
|
||||
|
Reference in New Issue
Block a user