fs/ufs: use ktime_get_real_seconds for sb and cg timestamps
[linux-2.6-microblaze.git] / fs / ufs / util.h
index 1907be6..1fd3011 100644 (file)
@@ -590,3 +590,17 @@ static inline int ufs_is_data_ptr_zero(struct ufs_sb_private_info *uspi,
        else
                return *(__fs32 *)p == 0;
 }
+
+static inline __fs32 ufs_get_seconds(struct super_block *sbp)
+{
+       time64_t now = ktime_get_real_seconds();
+
+       /* Signed 32-bit interpretation wraps around in 2038, which
+        * happens in ufs1 inode stamps but not ufs2 using 64-bits
+        * stamps. For superblock and blockgroup, let's assume
+        * unsigned 32-bit stamps, which are good until y2106.
+        * Wrap around rather than clamp here to make the dirty
+        * file system detection work in the superblock stamp.
+        */
+       return cpu_to_fs32(sbp, lower_32_bits(now));
+}