From: Christoph Hellwig Date: Wed, 30 Jun 2021 22:38:56 +0000 (-0400) Subject: xfs: move the di_crtime field to struct xfs_inode X-Git-Tag: v5.13.0-rc0~26 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a1f6b38896ec8ac5ae7fa574ec0f88a721089953;p=thirdparty%2Fxfsprogs-dev.git xfs: move the di_crtime field to struct xfs_inode Source kernel commit: e98d5e882b3ccb0f7f38d4e893fe60c1dd7934db Move the crtime field from struct xfs_icdinode into stuct xfs_inode and remove the now entirely unused struct xfs_icdinode. Signed-off-by: Christoph Hellwig Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Signed-off-by: Eric Sandeen --- diff --git a/include/xfs_inode.h b/include/xfs_inode.h index 8e75ad911..0551fe457 100644 --- a/include/xfs_inode.h +++ b/include/xfs_inode.h @@ -90,7 +90,7 @@ typedef struct xfs_inode { uint8_t i_forkoff; /* attr fork offset >> 3 */ uint16_t i_diflags; /* XFS_DIFLAG_... */ uint64_t i_diflags2; /* XFS_DIFLAG2_... */ - struct xfs_icdinode i_d; /* most of ondisk inode */ + struct timespec64 i_crtime; /* time created */ xfs_extnum_t i_cnextents; /* # of extents in cow fork */ unsigned int i_cformat; /* format of cow fork */ diff --git a/libxfs/util.c b/libxfs/util.c index cc2e6f28a..d227a2908 100644 --- a/libxfs/util.c +++ b/libxfs/util.c @@ -283,12 +283,10 @@ libxfs_init_new_inode( ip->i_diflags = pip ? 0 : xfs_flags2diflags(ip, fsx->fsx_xflags); if (xfs_sb_version_has_v3inode(&ip->i_mount->m_sb)) { - ASSERT(ip->i_d.di_ino == ino); - ASSERT(uuid_equal(&ip->i_d.di_uuid, &mp->m_sb.sb_meta_uuid)); VFS_I(ip)->i_version = 1; ip->i_diflags2 = pip ? ip->i_mount->m_ino_geo.new_diflags2 : xfs_flags2diflags2(ip, fsx->fsx_xflags); - ip->i_d.di_crtime = VFS_I(ip)->i_mtime; /* struct copy */ + ip->i_crtime = VFS_I(ip)->i_mtime; /* struct copy */ ip->i_cowextsize = pip ? 0 : fsx->fsx_cowextsize; } @@ -351,7 +349,6 @@ libxfs_iflush_int( /* set *dip = inode's place in the buffer */ dip = xfs_buf_offset(bp, ip->i_imap.im_boffset); - ASSERT(ip->i_d.di_magic == XFS_DINODE_MAGIC); if (XFS_ISREG(ip)) { ASSERT( (ip->i_df.if_format == XFS_DINODE_FMT_EXTENTS) || (ip->i_df.if_format == XFS_DINODE_FMT_BTREE) ); diff --git a/libxfs/xfs_format.h b/libxfs/xfs_format.h index 9f7f1300a..37570cf05 100644 --- a/libxfs/xfs_format.h +++ b/libxfs/xfs_format.h @@ -955,9 +955,8 @@ static inline time64_t xfs_bigtime_to_unix(uint64_t ondisk_seconds) * attribute use the XFS_DFORK_DPTR, XFS_DFORK_APTR, and XFS_DFORK_PTR macros * below. * - * There is a very similar struct icdinode in xfs_inode which matches the - * layout of the first 96 bytes of this structure, but is kept in native - * format instead of big endian. + * There is a very similar struct xfs_log_dinode which matches the layout of + * this structure, but is kept in native format instead of big endian. * * Note: di_flushiter is only used by v1/2 inodes - it's effectively a zeroed * padding field for v3 inodes. diff --git a/libxfs/xfs_inode_buf.c b/libxfs/xfs_inode_buf.c index d41e2f326..02997a8dd 100644 --- a/libxfs/xfs_inode_buf.c +++ b/libxfs/xfs_inode_buf.c @@ -170,7 +170,6 @@ xfs_inode_from_disk( struct xfs_inode *ip, struct xfs_dinode *from) { - struct xfs_icdinode *to = &ip->i_d; struct inode *inode = VFS_I(ip); int error; xfs_failaddr_t fa; @@ -236,7 +235,7 @@ xfs_inode_from_disk( if (xfs_sb_version_has_v3inode(&ip->i_mount->m_sb)) { inode_set_iversion_queried(inode, be64_to_cpu(from->di_changecount)); - to->di_crtime = xfs_inode_from_disk_ts(from, from->di_crtime); + ip->i_crtime = xfs_inode_from_disk_ts(from, from->di_crtime); ip->i_diflags2 = be64_to_cpu(from->di_flags2); ip->i_cowextsize = be32_to_cpu(from->di_cowextsize); } @@ -283,7 +282,6 @@ xfs_inode_to_disk( struct xfs_dinode *to, xfs_lsn_t lsn) { - struct xfs_icdinode *from = &ip->i_d; struct inode *inode = VFS_I(ip); to->di_magic = cpu_to_be16(XFS_DINODE_MAGIC); @@ -315,7 +313,7 @@ xfs_inode_to_disk( if (xfs_sb_version_has_v3inode(&ip->i_mount->m_sb)) { to->di_version = 3; to->di_changecount = cpu_to_be64(inode_peek_iversion(inode)); - to->di_crtime = xfs_inode_to_disk_ts(ip, from->di_crtime); + to->di_crtime = xfs_inode_to_disk_ts(ip, ip->i_crtime); to->di_flags2 = cpu_to_be64(ip->i_diflags2); to->di_cowextsize = cpu_to_be32(ip->i_cowextsize); to->di_ino = cpu_to_be64(ip->i_ino); diff --git a/libxfs/xfs_inode_buf.h b/libxfs/xfs_inode_buf.h index 2f6015acf..7f865bb4d 100644 --- a/libxfs/xfs_inode_buf.h +++ b/libxfs/xfs_inode_buf.h @@ -9,16 +9,6 @@ struct xfs_inode; struct xfs_dinode; -/* - * In memory representation of the XFS inode. This is held in the in-core struct - * xfs_inode and represents the current on disk values but the structure is not - * in on-disk format. That is, this structure is always translated to on-disk - * format specific structures at the appropriate time. - */ -struct xfs_icdinode { - struct timespec64 di_crtime; /* time created */ -}; - /* * Inode location information. Stored in the inode and passed to * xfs_imap_to_bp() to get a buffer and dinode for a given inode. diff --git a/libxfs/xfs_trans_inode.c b/libxfs/xfs_trans_inode.c index c0a109840..854446a89 100644 --- a/libxfs/xfs_trans_inode.c +++ b/libxfs/xfs_trans_inode.c @@ -67,7 +67,7 @@ xfs_trans_ichgtime( if (flags & XFS_ICHGTIME_CHG) inode->i_ctime = tv; if (flags & XFS_ICHGTIME_CREATE) - ip->i_d.di_crtime = tv; + ip->i_crtime = tv; } /* diff --git a/repair/phase6.c b/repair/phase6.c index 6d8f6d9bb..9ada8f2bc 100644 --- a/repair/phase6.c +++ b/repair/phase6.c @@ -440,7 +440,6 @@ res_failed( static inline void reset_inode_fields(struct xfs_inode *ip) { - memset(&ip->i_d, 0, sizeof(ip->i_d)); ip->i_projid = 0; ip->i_disk_size = 0; ip->i_nblocks = 0; @@ -450,6 +449,8 @@ reset_inode_fields(struct xfs_inode *ip) ip->i_forkoff = 0; ip->i_diflags = 0; ip->i_diflags2 = 0; + ip->i_crtime.tv_sec = 0; + ip->i_crtime.tv_nsec = 0; } static void