@@ -849,11 +849,30 @@ struct xfs_agfl {
ASSERT(xfs_daddr_to_agno(mp, d) == \
xfs_daddr_to_agno(mp, (d) + (len) - 1)))
+/*
+ * XFS Timestamps
+ * ==============
+ *
+ * Inode timestamps consist of signed 32-bit counters for seconds and
+ * nanoseconds; time zero is the Unix epoch, Jan 1 00:00:00 UTC 1970.
+ */
typedef struct xfs_timestamp {
__be32 t_sec; /* timestamp seconds */
__be32 t_nsec; /* timestamp nanoseconds */
} xfs_timestamp_t;
+/*
+ * Smallest possible timestamp with traditional timestamps, which is
+ * Dec 13 20:45:52 UTC 1901.
+ */
+#define XFS_INO_TIME_MIN ((int64_t)S32_MIN)
+
+/*
+ * Largest possible timestamp with traditional timestamps, which is
+ * Jan 19 03:14:07 UTC 2038.
+ */
+#define XFS_INO_TIME_MAX ((int64_t)S32_MAX)
+
/*
* On-disk inode structure.
*
@@ -15,6 +15,18 @@
"XFS: offsetof(" #structname ", " #member ") is wrong, " \
"expected " #off)
+#define XFS_CHECK_VALUE(value, expected) \
+ BUILD_BUG_ON_MSG((value) != (expected), \
+ "XFS: value of " #value " is wrong, expected " #expected)
+
+static inline void __init
+xfs_check_limits(void)
+{
+ /* make sure timestamp limits are correct */
+ XFS_CHECK_VALUE(XFS_INO_TIME_MIN, -2147483648LL);
+ XFS_CHECK_VALUE(XFS_INO_TIME_MAX, 2147483647LL);
+}
+
static inline void __init
xfs_check_ondisk_structs(void)
{
@@ -1484,8 +1484,8 @@ xfs_fc_fill_super(
sb->s_maxbytes = MAX_LFS_FILESIZE;
sb->s_max_links = XFS_MAXLINK;
sb->s_time_gran = 1;
- sb->s_time_min = S32_MIN;
- sb->s_time_max = S32_MAX;
+ sb->s_time_min = XFS_INO_TIME_MIN;
+ sb->s_time_max = XFS_INO_TIME_MAX;
sb->s_iflags |= SB_I_CGROUPWB;
set_posix_acl_flag(sb);
@@ -2077,6 +2077,7 @@ init_xfs_fs(void)
{
int error;
+ xfs_check_limits();
xfs_check_ondisk_structs();
printk(KERN_INFO XFS_VERSION_STRING " with "