From: Christoph Hellwig Date: Wed, 22 Jan 2020 16:29:44 +0000 (-0500) Subject: xfs: merge the projid fields in struct xfs_icdinode X-Git-Tag: v5.5.0-rc0~29 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=e6bd76f07f684483f8fbf2c4b44d3af3ddb55d9e;p=users%2Fhch%2Fxfsprogs.git xfs: merge the projid fields in struct xfs_icdinode Source kernel commit: de7a866fd41b227b0aa6e9cbeb0dae221c12f542 There is no point in splitting the fields like this in an purely in-memory 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/db/check.c b/db/check.c index cc9d37124..3b713bdc5 100644 --- a/db/check.c +++ b/db/check.c @@ -2679,7 +2679,6 @@ process_inode( xfs_qcnt_t bc = 0; xfs_qcnt_t ic = 0; xfs_qcnt_t rc = 0; - xfs_dqid_t dqprid; int v = 0; mode_t mode; static char okfmts[] = { @@ -2899,9 +2898,8 @@ process_inode( break; } if (ic) { - dqprid = xfs_get_projid(&xino.i_d); /* dquot ID is u32 */ - quota_add(&dqprid, &xino.i_d.di_gid, &xino.i_d.di_uid, - 0, bc, ic, rc); + quota_add(&xino.i_d.di_projid, &xino.i_d.di_gid, + &xino.i_d.di_uid, 0, bc, ic, rc); } } totblocks = totdblocks + totiblocks + atotdblocks + atotiblocks; diff --git a/include/xfs_inode.h b/include/xfs_inode.h index 7345209a0..e95a4959e 100644 --- a/include/xfs_inode.h +++ b/include/xfs_inode.h @@ -119,27 +119,6 @@ static inline void inc_nlink(struct inode *inode) inode->i_nlink++; } -/* - * Project quota id helpers (previously projid was 16bit only and using two - * 16bit values to hold new 32bit projid was chosen to retain compatibility with - * "old" filesystems). - * - * Copied here from xfs_inode.h because it has to be defined after the struct - * xfs_inode... - */ -static inline prid_t -xfs_get_projid(struct xfs_icdinode *id) -{ - return (prid_t)id->di_projid_hi << 16 | id->di_projid_lo; -} - -static inline void -xfs_set_projid(struct xfs_icdinode *id, prid_t projid) -{ - id->di_projid_hi = (uint16_t) (projid >> 16); - id->di_projid_lo = (uint16_t) (projid & 0xffff); -} - static inline bool xfs_is_reflink_inode(struct xfs_inode *ip) { return ip->i_d.di_flags2 & XFS_DIFLAG2_REFLINK; diff --git a/libxfs/util.c b/libxfs/util.c index b6cc4e2c6..2e2ade24c 100644 --- a/libxfs/util.c +++ b/libxfs/util.c @@ -257,7 +257,7 @@ libxfs_ialloc( set_nlink(VFS_I(ip), nlink); ip->i_d.di_uid = cr->cr_uid; ip->i_d.di_gid = cr->cr_gid; - xfs_set_projid(&ip->i_d, pip ? 0 : fsx->fsx_projid); + ip->i_d.di_projid = pip ? 0 : fsx->fsx_projid; xfs_trans_ichgtime(tp, ip, XFS_ICHGTIME_CHG | XFS_ICHGTIME_MOD); /* diff --git a/libxfs/xfs_inode_buf.c b/libxfs/xfs_inode_buf.c index a95e2e152..776a116f0 100644 --- a/libxfs/xfs_inode_buf.c +++ b/libxfs/xfs_inode_buf.c @@ -209,13 +209,12 @@ xfs_inode_from_disk( to->di_version = from->di_version; if (to->di_version == 1) { set_nlink(inode, be16_to_cpu(from->di_onlink)); - to->di_projid_lo = 0; - to->di_projid_hi = 0; + to->di_projid = 0; to->di_version = 2; } else { set_nlink(inode, be32_to_cpu(from->di_nlink)); - to->di_projid_lo = be16_to_cpu(from->di_projid_lo); - to->di_projid_hi = be16_to_cpu(from->di_projid_hi); + to->di_projid = (prid_t)be16_to_cpu(from->di_projid_hi) << 16 | + be16_to_cpu(from->di_projid_lo); } to->di_format = from->di_format; @@ -275,8 +274,8 @@ xfs_inode_to_disk( to->di_format = from->di_format; to->di_uid = cpu_to_be32(from->di_uid); to->di_gid = cpu_to_be32(from->di_gid); - to->di_projid_lo = cpu_to_be16(from->di_projid_lo); - to->di_projid_hi = cpu_to_be16(from->di_projid_hi); + to->di_projid_lo = cpu_to_be16(from->di_projid & 0xffff); + to->di_projid_hi = cpu_to_be16(from->di_projid >> 16); memset(to->di_pad, 0, sizeof(to->di_pad)); to->di_atime.t_sec = cpu_to_be32(inode->i_atime.tv_sec); diff --git a/libxfs/xfs_inode_buf.h b/libxfs/xfs_inode_buf.h index c9ac69c82..fd94b1078 100644 --- a/libxfs/xfs_inode_buf.h +++ b/libxfs/xfs_inode_buf.h @@ -21,8 +21,7 @@ struct xfs_icdinode { uint16_t di_flushiter; /* incremented on flush */ uint32_t di_uid; /* owner's user id */ uint32_t di_gid; /* owner's group id */ - uint16_t di_projid_lo; /* lower part of owner's project id */ - uint16_t di_projid_hi; /* higher part of owner's project id */ + uint32_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 */