]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: use a struct timespec64 for the in-core crtime
authorChristoph Hellwig <hch@lst.de>
Wed, 22 Jan 2020 16:29:44 +0000 (11:29 -0500)
committerEric Sandeen <sandeen@redhat.com>
Wed, 22 Jan 2020 16:29:44 +0000 (11:29 -0500)
Source kernel commit: 8d2d878db897d7501aaa2f72e10bb28295bb5498

struct xfs_icdinode is purely an in-memory data structure, so don't use
a log on-disk structure for it.  This simplifies the code a bit, and
also reduces our include hell slightly.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
[darrick: fix a minor indenting problem in xfs_trans_ichgtime]
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
include/libxfs.h
include/xfs_inode.h
libxfs/libxfs_priv.h
libxfs/util.c
libxfs/xfs_inode_buf.c
libxfs/xfs_inode_buf.h
libxfs/xfs_trans_inode.c

index 3b7c51fe4c439c96d74d44aa75e410b33c338e27..aaac00f6761235169a4bab004191e35f95fdd546 100644 (file)
@@ -41,6 +41,7 @@ struct iomap;
 #define __round_mask(x, y) ((__typeof__(x))((y)-1))
 #define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1)
 #define unlikely(x) (x)
+#define timespec64 timespec
 
 /*
  * This mirrors the kernel include for xfs_buf.h - it's implicitly included in
index 9565adc1c0b97d13a269d60ba1d68c446e83312f..7345209a00bdd3bfceacd927b3ebec2d03c2d9ec 100644 (file)
@@ -160,7 +160,6 @@ extern void libxfs_trans_ichgtime(struct xfs_trans *,
                                struct xfs_inode *, int);
 extern int     libxfs_iflush_int (struct xfs_inode *, struct xfs_buf *);
 
-#define timespec64 timespec
 extern struct timespec64 current_time(struct inode *inode);
 
 /* Inode Cache Interfaces */
index 462ab421a668ed26c73776e444e6a4656beb4efb..03edf0d3ea6e845c46b6581e6ed81564fd8f597f 100644 (file)
@@ -62,6 +62,8 @@ extern kmem_zone_t *xfs_buf_zone;
 extern kmem_zone_t *xfs_inode_zone;
 extern kmem_zone_t *xfs_trans_zone;
 
+#define timespec64 timespec
+
 /* fake up iomap, (not) used in xfs_bmap.[ch] */
 #define IOMAP_F_SHARED                 0x04
 #define xfs_bmbt_to_iomap(a, b, c, d)  ((void) 0)
index 69110076d463218eec19a43ce9d51d35594380b6..b6cc4e2c6e3cc809d108cd6356a4a4e06db3e452 100644 (file)
@@ -294,8 +294,8 @@ libxfs_ialloc(
                VFS_I(ip)->i_version = 1;
                ip->i_d.di_flags2 = pip ? 0 : xfs_flags2diflags2(ip,
                                fsx->fsx_xflags);
-               ip->i_d.di_crtime.t_sec = (int32_t)VFS_I(ip)->i_mtime.tv_sec;
-               ip->i_d.di_crtime.t_nsec = (int32_t)VFS_I(ip)->i_mtime.tv_nsec;
+               ip->i_d.di_crtime.tv_sec = (int32_t)VFS_I(ip)->i_mtime.tv_sec;
+               ip->i_d.di_crtime.tv_nsec = (int32_t)VFS_I(ip)->i_mtime.tv_nsec;
                ip->i_d.di_cowextsize = pip ? 0 : fsx->fsx_cowextsize;
        }
 
index 4859b739a8547015ceb55eb871616abc23d26e4b..a95e2e1521f1d36af352b1c4423371afb4fb327e 100644 (file)
@@ -252,8 +252,8 @@ xfs_inode_from_disk(
        if (to->di_version == 3) {
                inode_set_iversion_queried(inode,
                                           be64_to_cpu(from->di_changecount));
-               to->di_crtime.t_sec = be32_to_cpu(from->di_crtime.t_sec);
-               to->di_crtime.t_nsec = be32_to_cpu(from->di_crtime.t_nsec);
+               to->di_crtime.tv_sec = be32_to_cpu(from->di_crtime.t_sec);
+               to->di_crtime.tv_nsec = be32_to_cpu(from->di_crtime.t_nsec);
                to->di_flags2 = be64_to_cpu(from->di_flags2);
                to->di_cowextsize = be32_to_cpu(from->di_cowextsize);
        }
@@ -302,8 +302,8 @@ xfs_inode_to_disk(
 
        if (from->di_version == 3) {
                to->di_changecount = cpu_to_be64(inode_peek_iversion(inode));
-               to->di_crtime.t_sec = cpu_to_be32(from->di_crtime.t_sec);
-               to->di_crtime.t_nsec = cpu_to_be32(from->di_crtime.t_nsec);
+               to->di_crtime.t_sec = cpu_to_be32(from->di_crtime.tv_sec);
+               to->di_crtime.t_nsec = cpu_to_be32(from->di_crtime.tv_nsec);
                to->di_flags2 = cpu_to_be64(from->di_flags2);
                to->di_cowextsize = cpu_to_be32(from->di_cowextsize);
                to->di_ino = cpu_to_be64(ip->i_ino);
index ab0f841653174e8d142a771c7bbca683a38e5737..c9ac69c82d21ffb34070b72746c2b2fa12a78a68 100644 (file)
@@ -37,7 +37,7 @@ struct xfs_icdinode {
        uint64_t        di_flags2;      /* more random flags */
        uint32_t        di_cowextsize;  /* basic cow extent size for file */
 
-       xfs_ictimestamp_t di_crtime;    /* time created */
+       struct timespec64 di_crtime;    /* time created */
 };
 
 /*
index 7fa0c184a9b036ccdef59c0856fb3d536a3ca318..f53b4c8dfc8bb2e0a09820a20bdab837c853177a 100644 (file)
@@ -52,7 +52,7 @@ xfs_trans_ichgtime(
        int                     flags)
 {
        struct inode            *inode = VFS_I(ip);
-       struct timespec64 tv;
+       struct timespec64       tv;
 
        ASSERT(tp);
        ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
@@ -63,10 +63,8 @@ xfs_trans_ichgtime(
                inode->i_mtime = tv;
        if (flags & XFS_ICHGTIME_CHG)
                inode->i_ctime = tv;
-       if (flags & XFS_ICHGTIME_CREATE) {
-               ip->i_d.di_crtime.t_sec = (int32_t)tv.tv_sec;
-               ip->i_d.di_crtime.t_nsec = (int32_t)tv.tv_nsec;
-       }
+       if (flags & XFS_ICHGTIME_CREATE)
+               ip->i_d.di_crtime = tv;
 }
 
 /*