From 0ca7fa97f5e86b51cdbd6a3e87e85f06e9033da7 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Wed, 30 Jun 2021 18:32:24 -0400 Subject: [PATCH] xfs: move the di_projid field to struct xfs_inode Source kernel commit: ceaf603c7024d3c021803a3e90e893feda8d76e2 In preparation of removing the historic icinode struct, move the projid 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 --- include/xfs_inode.h | 1 + libxfs/util.c | 2 +- libxfs/xfs_inode_buf.c | 8 ++++---- libxfs/xfs_inode_buf.h | 1 - repair/phase6.c | 1 + repair/quotacheck.c | 2 +- 6 files changed, 8 insertions(+), 7 deletions(-) diff --git a/include/xfs_inode.h b/include/xfs_inode.h index 01a62daa0..5b86932c9 100644 --- a/include/xfs_inode.h +++ b/include/xfs_inode.h @@ -78,6 +78,7 @@ typedef struct xfs_inode { struct xfs_ifork i_df; /* data fork */ struct xfs_inode_log_item *i_itemp; /* logging information */ unsigned int i_delayed_blks; /* count of delay alloc blks */ + prid_t i_projid; /* owner's project id */ struct xfs_icdinode i_d; /* most of ondisk inode */ xfs_extnum_t i_cnextents; /* # of extents in cow fork */ diff --git a/libxfs/util.c b/libxfs/util.c index c666ee88c..c3fddbb26 100644 --- a/libxfs/util.c +++ b/libxfs/util.c @@ -267,7 +267,7 @@ libxfs_init_new_inode( set_nlink(VFS_I(ip), nlink); i_uid_write(VFS_I(ip), cr->cr_uid); i_gid_write(VFS_I(ip), cr->cr_gid); - ip->i_d.di_projid = pip ? 0 : fsx->fsx_projid; + ip->i_projid = pip ? 0 : fsx->fsx_projid; xfs_trans_ichgtime(tp, ip, XFS_ICHGTIME_CHG | XFS_ICHGTIME_MOD); if (pip && (VFS_I(pip)->i_mode & S_ISGID)) { diff --git a/libxfs/xfs_inode_buf.c b/libxfs/xfs_inode_buf.c index c7be54a29..0ae2b61bd 100644 --- a/libxfs/xfs_inode_buf.c +++ b/libxfs/xfs_inode_buf.c @@ -203,10 +203,10 @@ xfs_inode_from_disk( */ if (unlikely(from->di_version == 1)) { set_nlink(inode, be16_to_cpu(from->di_onlink)); - to->di_projid = 0; + ip->i_projid = 0; } else { set_nlink(inode, be32_to_cpu(from->di_nlink)); - to->di_projid = (prid_t)be16_to_cpu(from->di_projid_hi) << 16 | + ip->i_projid = (prid_t)be16_to_cpu(from->di_projid_hi) << 16 | be16_to_cpu(from->di_projid_lo); } @@ -291,8 +291,8 @@ xfs_inode_to_disk( to->di_format = xfs_ifork_format(&ip->i_df); to->di_uid = cpu_to_be32(i_uid_read(inode)); to->di_gid = cpu_to_be32(i_gid_read(inode)); - to->di_projid_lo = cpu_to_be16(from->di_projid & 0xffff); - to->di_projid_hi = cpu_to_be16(from->di_projid >> 16); + to->di_projid_lo = cpu_to_be16(ip->i_projid & 0xffff); + to->di_projid_hi = cpu_to_be16(ip->i_projid >> 16); memset(to->di_pad, 0, sizeof(to->di_pad)); to->di_atime = xfs_inode_to_disk_ts(ip, inode->i_atime); diff --git a/libxfs/xfs_inode_buf.h b/libxfs/xfs_inode_buf.h index d7a019df0..406f66799 100644 --- a/libxfs/xfs_inode_buf.h +++ b/libxfs/xfs_inode_buf.h @@ -17,7 +17,6 @@ struct xfs_dinode; */ struct xfs_icdinode { uint16_t di_flushiter; /* incremented on flush */ - prid_t di_projid; /* owner's project id */ xfs_fsize_t di_size; /* number of bytes in file */ xfs_rfsblock_t di_nblocks; /* # of direct & btree blocks used */ xfs_extlen_t di_extsize; /* basic/minimum extent size for file */ diff --git a/repair/phase6.c b/repair/phase6.c index e8acba343..6526a0be8 100644 --- a/repair/phase6.c +++ b/repair/phase6.c @@ -441,6 +441,7 @@ static inline void reset_inode_fields(struct xfs_inode *ip) { memset(&ip->i_d, 0, sizeof(ip->i_d)); + ip->i_projid = 0; } static void diff --git a/repair/quotacheck.c b/repair/quotacheck.c index 0a505c9cb..0c4d48406 100644 --- a/repair/quotacheck.c +++ b/repair/quotacheck.c @@ -229,7 +229,7 @@ quotacheck_adjust( if (group_dquots) qc_adjust(group_dquots, i_gid_read(VFS_I(ip)), blocks, rtblks); if (proj_dquots) - qc_adjust(proj_dquots, ip->i_d.di_projid, blocks, rtblks); + qc_adjust(proj_dquots, ip->i_projid, blocks, rtblks); libxfs_irele(ip); } -- 2.39.5