Blame SOURCES/xfsprogs-5.5.0-xfs-use-a-struct-timespec64-for-the-in-core-crtime.patch

0bf83d
From cb49e9a41477791af390a397c97da28da31fb81d Mon Sep 17 00:00:00 2001
0bf83d
From: Christoph Hellwig <hch@lst.de>
0bf83d
Date: Wed, 22 Jan 2020 11:29:44 -0500
0bf83d
Subject: [PATCH] xfs: use a struct timespec64 for the in-core crtime
0bf83d
0bf83d
Source kernel commit: 8d2d878db897d7501aaa2f72e10bb28295bb5498
0bf83d
0bf83d
struct xfs_icdinode is purely an in-memory data structure, so don't use
0bf83d
a log on-disk structure for it.  This simplifies the code a bit, and
0bf83d
also reduces our include hell slightly.
0bf83d
0bf83d
Signed-off-by: Christoph Hellwig <hch@lst.de>
0bf83d
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
0bf83d
[darrick: fix a minor indenting problem in xfs_trans_ichgtime]
0bf83d
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
0bf83d
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
0bf83d
---
0bf83d
0bf83d
diff --git a/include/libxfs.h b/include/libxfs.h
0bf83d
index 2bdef70..731561c 100644
0bf83d
--- a/include/libxfs.h
0bf83d
+++ b/include/libxfs.h
0bf83d
@@ -36,6 +36,8 @@ extern uint32_t crc32c_le(uint32_t crc, unsigned char const *p, size_t len);
0bf83d
 
0bf83d
 #include "xfs_cksum.h"
0bf83d
 
0bf83d
+#define timespec64 timespec
0bf83d
+
0bf83d
 /*
0bf83d
  * This mirrors the kernel include for xfs_buf.h - it's implicitly included in
0bf83d
  * every files via a similar include in the kernel xfs_linux.h.
0bf83d
diff --git a/include/xfs_inode.h b/include/xfs_inode.h
0bf83d
index 76f9ac7..e03d1cb 100644
0bf83d
--- a/include/xfs_inode.h
0bf83d
+++ b/include/xfs_inode.h
0bf83d
@@ -161,7 +161,6 @@ extern void	libxfs_trans_ichgtime(struct xfs_trans *,
0bf83d
 				struct xfs_inode *, int);
0bf83d
 extern int	libxfs_iflush_int (struct xfs_inode *, struct xfs_buf *);
0bf83d
 
0bf83d
-#define timespec64 timespec
0bf83d
 extern struct timespec64 current_time(struct inode *inode);
0bf83d
 
0bf83d
 /* Inode Cache Interfaces */
0bf83d
diff --git a/libxfs/libxfs_priv.h b/libxfs/libxfs_priv.h
0bf83d
index b45d07e..8232f89 100644
0bf83d
--- a/libxfs/libxfs_priv.h
0bf83d
+++ b/libxfs/libxfs_priv.h
0bf83d
@@ -62,6 +62,8 @@ extern kmem_zone_t *xfs_buf_zone;
0bf83d
 extern kmem_zone_t *xfs_inode_zone;
0bf83d
 extern kmem_zone_t *xfs_trans_zone;
0bf83d
 
0bf83d
+#define timespec64 timespec
0bf83d
+
0bf83d
 /* CRC stuff, buffer API dependent on it */
0bf83d
 #define crc32c(c,p,l)	crc32c_le((c),(unsigned char const *)(p),(l))
0bf83d
 
0bf83d
diff --git a/libxfs/util.c b/libxfs/util.c
0bf83d
index 951f7cf..9383bb8 100644
0bf83d
--- a/libxfs/util.c
0bf83d
+++ b/libxfs/util.c
0bf83d
@@ -170,10 +170,8 @@ libxfs_trans_ichgtime(
0bf83d
 		VFS_I(ip)->i_mtime = tv;
0bf83d
 	if (flags & XFS_ICHGTIME_CHG)
0bf83d
 		VFS_I(ip)->i_ctime = tv;
0bf83d
-	if (flags & XFS_ICHGTIME_CREATE) {
0bf83d
-		ip->i_d.di_crtime.t_sec = (int32_t)tv.tv_sec;
0bf83d
-		ip->i_d.di_crtime.t_nsec = (int32_t)tv.tv_nsec;
0bf83d
-	}
0bf83d
+	if (flags & XFS_ICHGTIME_CREATE)
0bf83d
+		ip->i_d.di_crtime = tv;
0bf83d
 }
0bf83d
 
0bf83d
 STATIC uint16_t
0bf83d
@@ -321,8 +319,8 @@ libxfs_ialloc(
0bf83d
 		VFS_I(ip)->i_version = 1;
0bf83d
 		ip->i_d.di_flags2 = pip ? 0 : xfs_flags2diflags2(ip,
0bf83d
 				fsx->fsx_xflags);
0bf83d
-		ip->i_d.di_crtime.t_sec = (int32_t)VFS_I(ip)->i_mtime.tv_sec;
0bf83d
-		ip->i_d.di_crtime.t_nsec = (int32_t)VFS_I(ip)->i_mtime.tv_nsec;
0bf83d
+		ip->i_d.di_crtime.tv_sec = (int32_t)VFS_I(ip)->i_mtime.tv_sec;
0bf83d
+		ip->i_d.di_crtime.tv_nsec = (int32_t)VFS_I(ip)->i_mtime.tv_nsec;
0bf83d
 		ip->i_d.di_cowextsize = pip ? 0 : fsx->fsx_cowextsize;
0bf83d
 	}
0bf83d
 
0bf83d
diff --git a/libxfs/xfs_inode_buf.c b/libxfs/xfs_inode_buf.c
0bf83d
index 503990f..975f097 100644
0bf83d
--- a/libxfs/xfs_inode_buf.c
0bf83d
+++ b/libxfs/xfs_inode_buf.c
0bf83d
@@ -254,8 +254,8 @@ xfs_inode_from_disk(
0bf83d
 	if (to->di_version == 3) {
0bf83d
 		inode_set_iversion_queried(inode,
0bf83d
 					   be64_to_cpu(from->di_changecount));
0bf83d
-		to->di_crtime.t_sec = be32_to_cpu(from->di_crtime.t_sec);
0bf83d
-		to->di_crtime.t_nsec = be32_to_cpu(from->di_crtime.t_nsec);
0bf83d
+		to->di_crtime.tv_sec = be32_to_cpu(from->di_crtime.t_sec);
0bf83d
+		to->di_crtime.tv_nsec = be32_to_cpu(from->di_crtime.t_nsec);
0bf83d
 		to->di_flags2 = be64_to_cpu(from->di_flags2);
0bf83d
 		to->di_cowextsize = be32_to_cpu(from->di_cowextsize);
0bf83d
 	}
0bf83d
@@ -304,8 +304,8 @@ xfs_inode_to_disk(
0bf83d
 
0bf83d
 	if (from->di_version == 3) {
0bf83d
 		to->di_changecount = cpu_to_be64(inode_peek_iversion(inode));
0bf83d
-		to->di_crtime.t_sec = cpu_to_be32(from->di_crtime.t_sec);
0bf83d
-		to->di_crtime.t_nsec = cpu_to_be32(from->di_crtime.t_nsec);
0bf83d
+		to->di_crtime.t_sec = cpu_to_be32(from->di_crtime.tv_sec);
0bf83d
+		to->di_crtime.t_nsec = cpu_to_be32(from->di_crtime.tv_nsec);
0bf83d
 		to->di_flags2 = cpu_to_be64(from->di_flags2);
0bf83d
 		to->di_cowextsize = cpu_to_be32(from->di_cowextsize);
0bf83d
 		to->di_ino = cpu_to_be64(ip->i_ino);
0bf83d
diff --git a/libxfs/xfs_inode_buf.h b/libxfs/xfs_inode_buf.h
0bf83d
index ab0f841..c9ac69c 100644
0bf83d
--- a/libxfs/xfs_inode_buf.h
0bf83d
+++ b/libxfs/xfs_inode_buf.h
0bf83d
@@ -37,7 +37,7 @@ struct xfs_icdinode {
0bf83d
 	uint64_t	di_flags2;	/* more random flags */
0bf83d
 	uint32_t	di_cowextsize;	/* basic cow extent size for file */
0bf83d
 
0bf83d
-	xfs_ictimestamp_t di_crtime;	/* time created */
0bf83d
+	struct timespec64 di_crtime;	/* time created */
0bf83d
 };
0bf83d
 
0bf83d
 /*