From: Christoph Hellwig Date: Wed, 30 Jun 2021 22:35:12 +0000 (-0400) Subject: xfs: move the di_flags field to struct xfs_inode X-Git-Tag: v5.13.0-rc0~28 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4350eee73e9871caffc794f9d5d04331d67be3a0;p=thirdparty%2Fxfsprogs-dev.git xfs: move the di_flags field to struct xfs_inode Source kernel commit: db07349da2f564742c0f23528691991e641e315e In preparation of removing the historic icinode struct, move the flags field into the containing xfs_inode structure. 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 ef9700677..7df3c7692 100644 --- a/include/xfs_inode.h +++ b/include/xfs_inode.h @@ -88,6 +88,7 @@ typedef struct xfs_inode { uint16_t i_flushiter; /* incremented on flush */ }; uint8_t i_forkoff; /* attr fork offset >> 3 */ + uint16_t i_diflags; /* XFS_DIFLAG_... */ struct xfs_icdinode i_d; /* most of ondisk inode */ xfs_extnum_t i_cnextents; /* # of extents in cow fork */ @@ -139,7 +140,7 @@ static inline xfs_fsize_t XFS_ISIZE(struct xfs_inode *ip) return ip->i_size; return ip->i_disk_size; } -#define XFS_IS_REALTIME_INODE(ip) ((ip)->i_d.di_flags & XFS_DIFLAG_REALTIME) +#define XFS_IS_REALTIME_INODE(ip) ((ip)->i_diflags & XFS_DIFLAG_REALTIME) /* inode link counts */ static inline void set_nlink(struct inode *inode, uint32_t nlink) diff --git a/libxfs/util.c b/libxfs/util.c index 1546541cf..f853a32f1 100644 --- a/libxfs/util.c +++ b/libxfs/util.c @@ -156,7 +156,7 @@ xfs_flags2diflags( { /* can't set PREALLOC this way, just preserve it */ uint16_t di_flags = - (ip->i_d.di_flags & XFS_DIFLAG_PREALLOC); + (ip->i_diflags & XFS_DIFLAG_PREALLOC); if (xflags & FS_XFLAG_IMMUTABLE) di_flags |= XFS_DIFLAG_IMMUTABLE; @@ -218,24 +218,24 @@ xfs_inode_propagate_flags( umode_t mode = VFS_I(ip)->i_mode; if ((mode & S_IFMT) == S_IFDIR) { - if (pip->i_d.di_flags & XFS_DIFLAG_RTINHERIT) + if (pip->i_diflags & XFS_DIFLAG_RTINHERIT) di_flags |= XFS_DIFLAG_RTINHERIT; - if (pip->i_d.di_flags & XFS_DIFLAG_EXTSZINHERIT) { + if (pip->i_diflags & XFS_DIFLAG_EXTSZINHERIT) { di_flags |= XFS_DIFLAG_EXTSZINHERIT; ip->i_extsize = pip->i_extsize; } } else { - if ((pip->i_d.di_flags & XFS_DIFLAG_RTINHERIT) && + if ((pip->i_diflags & XFS_DIFLAG_RTINHERIT) && xfs_sb_version_hasrealtime(&ip->i_mount->m_sb)) di_flags |= XFS_DIFLAG_REALTIME; - if (pip->i_d.di_flags & XFS_DIFLAG_EXTSZINHERIT) { + if (pip->i_diflags & XFS_DIFLAG_EXTSZINHERIT) { di_flags |= XFS_DIFLAG_EXTSIZE; ip->i_extsize = pip->i_extsize; } } - if (pip->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) + if (pip->i_diflags & XFS_DIFLAG_PROJINHERIT) di_flags |= XFS_DIFLAG_PROJINHERIT; - ip->i_d.di_flags |= di_flags; + ip->i_diflags |= di_flags; } /* @@ -280,7 +280,7 @@ libxfs_init_new_inode( ip->i_df.if_nextents = 0; ASSERT(ip->i_nblocks == 0); ip->i_extsize = pip ? 0 : fsx->fsx_extsize; - ip->i_d.di_flags = pip ? 0 : xfs_flags2diflags(ip, fsx->fsx_xflags); + 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); @@ -307,7 +307,7 @@ libxfs_init_new_inode( break; case S_IFREG: case S_IFDIR: - if (pip && (pip->i_d.di_flags & XFS_DIFLAG_ANY)) + if (pip && (pip->i_diflags & XFS_DIFLAG_ANY)) xfs_inode_propagate_flags(ip, pip); /* FALLTHROUGH */ case S_IFLNK: diff --git a/libxfs/xfs_bmap_btree.c b/libxfs/xfs_bmap_btree.c index 232e58762..4c456df94 100644 --- a/libxfs/xfs_bmap_btree.c +++ b/libxfs/xfs_bmap_btree.c @@ -181,7 +181,7 @@ xfs_bmbt_update_cursor( struct xfs_btree_cur *dst) { ASSERT((dst->bc_tp->t_firstblock != NULLFSBLOCK) || - (dst->bc_ino.ip->i_d.di_flags & XFS_DIFLAG_REALTIME)); + (dst->bc_ino.ip->i_diflags & XFS_DIFLAG_REALTIME)); dst->bc_ino.allocated += src->bc_ino.allocated; dst->bc_tp->t_firstblock = src->bc_tp->t_firstblock; diff --git a/libxfs/xfs_inode_buf.c b/libxfs/xfs_inode_buf.c index 51f3ccf0c..dc16ca718 100644 --- a/libxfs/xfs_inode_buf.c +++ b/libxfs/xfs_inode_buf.c @@ -228,7 +228,7 @@ xfs_inode_from_disk( ip->i_nblocks = be64_to_cpu(from->di_nblocks); ip->i_extsize = be32_to_cpu(from->di_extsize); ip->i_forkoff = from->di_forkoff; - to->di_flags = be16_to_cpu(from->di_flags); + ip->i_diflags = be16_to_cpu(from->di_flags); if (from->di_dmevmask || from->di_dmstate) xfs_iflags_set(ip, XFS_IPRESERVE_DM_FIELDS); @@ -310,7 +310,7 @@ xfs_inode_to_disk( to->di_anextents = cpu_to_be16(xfs_ifork_nextents(ip->i_afp)); to->di_forkoff = ip->i_forkoff; to->di_aformat = xfs_ifork_format(ip->i_afp); - to->di_flags = cpu_to_be16(from->di_flags); + to->di_flags = cpu_to_be16(ip->i_diflags); if (xfs_sb_version_has_v3inode(&ip->i_mount->m_sb)) { to->di_version = 3; diff --git a/libxfs/xfs_inode_buf.h b/libxfs/xfs_inode_buf.h index 39f4ad441..cfad369e7 100644 --- a/libxfs/xfs_inode_buf.h +++ b/libxfs/xfs_inode_buf.h @@ -16,8 +16,6 @@ struct xfs_dinode; * format specific structures at the appropriate time. */ struct xfs_icdinode { - uint16_t di_flags; /* random flags, XFS_DIFLAG_... */ - uint64_t di_flags2; /* more random flags */ struct timespec64 di_crtime; /* time created */ diff --git a/libxfs/xfs_rtbitmap.c b/libxfs/xfs_rtbitmap.c index db3e2449f..f08efb7c3 100644 --- a/libxfs/xfs_rtbitmap.c +++ b/libxfs/xfs_rtbitmap.c @@ -995,8 +995,8 @@ xfs_rtfree_extent( */ if (tp->t_frextents_delta + mp->m_sb.sb_frextents == mp->m_sb.sb_rextents) { - if (!(mp->m_rbmip->i_d.di_flags & XFS_DIFLAG_NEWRTBM)) - mp->m_rbmip->i_d.di_flags |= XFS_DIFLAG_NEWRTBM; + if (!(mp->m_rbmip->i_diflags & XFS_DIFLAG_NEWRTBM)) + mp->m_rbmip->i_diflags |= XFS_DIFLAG_NEWRTBM; *(uint64_t *)&VFS_I(mp->m_rbmip)->i_atime = 0; xfs_trans_log_inode(tp, mp->m_rbmip, XFS_ILOG_CORE); } diff --git a/mkfs/proto.c b/mkfs/proto.c index d9f84cb93..6b22cc6a9 100644 --- a/mkfs/proto.c +++ b/mkfs/proto.c @@ -208,7 +208,7 @@ rsvfile( libxfs_trans_ichgtime(tp, ip, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); - ip->i_d.di_flags |= XFS_DIFLAG_PREALLOC; + ip->i_diflags |= XFS_DIFLAG_PREALLOC; libxfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); error = -libxfs_trans_commit(tp); @@ -652,7 +652,7 @@ rtinit( */ mp->m_sb.sb_rbmino = rbmip->i_ino; rbmip->i_disk_size = mp->m_sb.sb_rbmblocks * mp->m_sb.sb_blocksize; - rbmip->i_d.di_flags = XFS_DIFLAG_NEWRTBM; + rbmip->i_diflags = XFS_DIFLAG_NEWRTBM; *(uint64_t *)&VFS_I(rbmip)->i_atime = 0; libxfs_trans_log_inode(tp, rbmip, XFS_ILOG_CORE); libxfs_log_sb(tp); diff --git a/repair/phase6.c b/repair/phase6.c index be77fa020..02aaa4911 100644 --- a/repair/phase6.c +++ b/repair/phase6.c @@ -448,6 +448,7 @@ reset_inode_fields(struct xfs_inode *ip) ip->i_cowextsize = 0; ip->i_flushiter = 0; ip->i_forkoff = 0; + ip->i_diflags = 0; } static void