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

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