Commit ceaf603c authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Darrick J. Wong

xfs: move the di_projid field to struct xfs_inode

In preparation of removing the historic icinode struct, move the projid
field into the containing xfs_inode structure.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
parent 7e2a8af5
...@@ -206,10 +206,10 @@ xfs_inode_from_disk( ...@@ -206,10 +206,10 @@ xfs_inode_from_disk(
*/ */
if (unlikely(from->di_version == 1)) { if (unlikely(from->di_version == 1)) {
set_nlink(inode, be16_to_cpu(from->di_onlink)); set_nlink(inode, be16_to_cpu(from->di_onlink));
to->di_projid = 0; ip->i_projid = 0;
} else { } else {
set_nlink(inode, be32_to_cpu(from->di_nlink)); 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); be16_to_cpu(from->di_projid_lo);
} }
...@@ -294,8 +294,8 @@ xfs_inode_to_disk( ...@@ -294,8 +294,8 @@ xfs_inode_to_disk(
to->di_format = xfs_ifork_format(&ip->i_df); to->di_format = xfs_ifork_format(&ip->i_df);
to->di_uid = cpu_to_be32(i_uid_read(inode)); to->di_uid = cpu_to_be32(i_uid_read(inode));
to->di_gid = cpu_to_be32(i_gid_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_lo = cpu_to_be16(ip->i_projid & 0xffff);
to->di_projid_hi = cpu_to_be16(from->di_projid >> 16); to->di_projid_hi = cpu_to_be16(ip->i_projid >> 16);
memset(to->di_pad, 0, sizeof(to->di_pad)); memset(to->di_pad, 0, sizeof(to->di_pad));
to->di_atime = xfs_inode_to_disk_ts(ip, inode->i_atime); to->di_atime = xfs_inode_to_disk_ts(ip, inode->i_atime);
......
...@@ -17,7 +17,6 @@ struct xfs_dinode; ...@@ -17,7 +17,6 @@ struct xfs_dinode;
*/ */
struct xfs_icdinode { struct xfs_icdinode {
uint16_t di_flushiter; /* incremented on flush */ 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_fsize_t di_size; /* number of bytes in file */
xfs_rfsblock_t di_nblocks; /* # of direct & btree blocks used */ xfs_rfsblock_t di_nblocks; /* # of direct & btree blocks used */
xfs_extlen_t di_extsize; /* basic/minimum extent size for file */ xfs_extlen_t di_extsize; /* basic/minimum extent size for file */
......
...@@ -1208,7 +1208,7 @@ xfs_swap_extents_check_format( ...@@ -1208,7 +1208,7 @@ xfs_swap_extents_check_format(
if (XFS_IS_QUOTA_ON(ip->i_mount) && if (XFS_IS_QUOTA_ON(ip->i_mount) &&
(!uid_eq(VFS_I(ip)->i_uid, VFS_I(tip)->i_uid) || (!uid_eq(VFS_I(ip)->i_uid, VFS_I(tip)->i_uid) ||
!gid_eq(VFS_I(ip)->i_gid, VFS_I(tip)->i_gid) || !gid_eq(VFS_I(ip)->i_gid, VFS_I(tip)->i_gid) ||
ip->i_d.di_projid != tip->i_d.di_projid)) ip->i_projid != tip->i_projid))
return -EINVAL; return -EINVAL;
/* Should never get a local format */ /* Should never get a local format */
......
...@@ -953,7 +953,7 @@ xfs_qm_id_for_quotatype( ...@@ -953,7 +953,7 @@ xfs_qm_id_for_quotatype(
case XFS_DQTYPE_GROUP: case XFS_DQTYPE_GROUP:
return i_gid_read(VFS_I(ip)); return i_gid_read(VFS_I(ip));
case XFS_DQTYPE_PROJ: case XFS_DQTYPE_PROJ:
return ip->i_d.di_projid; return ip->i_projid;
} }
ASSERT(0); ASSERT(0);
return 0; return 0;
......
...@@ -1204,7 +1204,7 @@ xfs_inode_match_id( ...@@ -1204,7 +1204,7 @@ xfs_inode_match_id(
return false; return false;
if ((eofb->eof_flags & XFS_EOF_FLAGS_PRID) && if ((eofb->eof_flags & XFS_EOF_FLAGS_PRID) &&
ip->i_d.di_projid != eofb->eof_prid) ip->i_projid != eofb->eof_prid)
return false; return false;
return true; return true;
...@@ -1228,7 +1228,7 @@ xfs_inode_match_id_union( ...@@ -1228,7 +1228,7 @@ xfs_inode_match_id_union(
return true; return true;
if ((eofb->eof_flags & XFS_EOF_FLAGS_PRID) && if ((eofb->eof_flags & XFS_EOF_FLAGS_PRID) &&
ip->i_d.di_projid == eofb->eof_prid) ip->i_projid == eofb->eof_prid)
return true; return true;
return false; return false;
......
...@@ -809,7 +809,7 @@ xfs_init_new_inode( ...@@ -809,7 +809,7 @@ xfs_init_new_inode(
inode = VFS_I(ip); inode = VFS_I(ip);
set_nlink(inode, nlink); set_nlink(inode, nlink);
inode->i_rdev = rdev; inode->i_rdev = rdev;
ip->i_d.di_projid = prid; ip->i_projid = prid;
if (dir && !(dir->i_mode & S_ISGID) && if (dir && !(dir->i_mode & S_ISGID) &&
(mp->m_flags & XFS_MOUNT_GRPID)) { (mp->m_flags & XFS_MOUNT_GRPID)) {
...@@ -1288,7 +1288,7 @@ xfs_link( ...@@ -1288,7 +1288,7 @@ xfs_link(
* the tree quota mechanism could be circumvented. * the tree quota mechanism could be circumvented.
*/ */
if (unlikely((tdp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) && if (unlikely((tdp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) &&
tdp->i_d.di_projid != sip->i_d.di_projid)) { tdp->i_projid != sip->i_projid)) {
error = -EXDEV; error = -EXDEV;
goto error_return; goto error_return;
} }
...@@ -3126,7 +3126,7 @@ xfs_rename( ...@@ -3126,7 +3126,7 @@ xfs_rename(
* tree quota mechanism would be circumvented. * tree quota mechanism would be circumvented.
*/ */
if (unlikely((target_dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) && if (unlikely((target_dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) &&
target_dp->i_d.di_projid != src_ip->i_d.di_projid)) { target_dp->i_projid != src_ip->i_projid)) {
error = -EXDEV; error = -EXDEV;
goto out_trans_cancel; goto out_trans_cancel;
} }
......
...@@ -54,6 +54,7 @@ typedef struct xfs_inode { ...@@ -54,6 +54,7 @@ typedef struct xfs_inode {
/* Miscellaneous state. */ /* Miscellaneous state. */
unsigned long i_flags; /* see defined flags below */ unsigned long i_flags; /* see defined flags below */
uint64_t i_delayed_blks; /* count of delay alloc blks */ uint64_t 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 */ struct xfs_icdinode i_d; /* most of ondisk inode */
...@@ -175,7 +176,7 @@ static inline prid_t ...@@ -175,7 +176,7 @@ static inline prid_t
xfs_get_initial_prid(struct xfs_inode *dp) xfs_get_initial_prid(struct xfs_inode *dp)
{ {
if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT)
return dp->i_d.di_projid; return dp->i_projid;
return XFS_PROJID_DEFAULT; return XFS_PROJID_DEFAULT;
} }
......
...@@ -357,8 +357,8 @@ xfs_inode_to_log_dinode( ...@@ -357,8 +357,8 @@ xfs_inode_to_log_dinode(
to->di_format = xfs_ifork_format(&ip->i_df); to->di_format = xfs_ifork_format(&ip->i_df);
to->di_uid = i_uid_read(inode); to->di_uid = i_uid_read(inode);
to->di_gid = i_gid_read(inode); to->di_gid = i_gid_read(inode);
to->di_projid_lo = from->di_projid & 0xffff; to->di_projid_lo = ip->i_projid & 0xffff;
to->di_projid_hi = from->di_projid >> 16; to->di_projid_hi = ip->i_projid >> 16;
memset(to->di_pad, 0, sizeof(to->di_pad)); memset(to->di_pad, 0, sizeof(to->di_pad));
memset(to->di_pad3, 0, sizeof(to->di_pad3)); memset(to->di_pad3, 0, sizeof(to->di_pad3));
......
...@@ -1123,7 +1123,7 @@ xfs_fill_fsxattr( ...@@ -1123,7 +1123,7 @@ xfs_fill_fsxattr(
fa->fsx_extsize = ip->i_d.di_extsize << ip->i_mount->m_sb.sb_blocklog; fa->fsx_extsize = ip->i_d.di_extsize << ip->i_mount->m_sb.sb_blocklog;
fa->fsx_cowextsize = ip->i_d.di_cowextsize << fa->fsx_cowextsize = ip->i_d.di_cowextsize <<
ip->i_mount->m_sb.sb_blocklog; ip->i_mount->m_sb.sb_blocklog;
fa->fsx_projid = ip->i_d.di_projid; fa->fsx_projid = ip->i_projid;
if (ifp && (ifp->if_flags & XFS_IFEXTENTS)) if (ifp && (ifp->if_flags & XFS_IFEXTENTS))
fa->fsx_nextents = xfs_iext_count(ifp); fa->fsx_nextents = xfs_iext_count(ifp);
else else
...@@ -1505,12 +1505,12 @@ xfs_ioctl_setattr( ...@@ -1505,12 +1505,12 @@ xfs_ioctl_setattr(
VFS_I(ip)->i_mode &= ~(S_ISUID|S_ISGID); VFS_I(ip)->i_mode &= ~(S_ISUID|S_ISGID);
/* Change the ownerships and register project quota modifications */ /* Change the ownerships and register project quota modifications */
if (ip->i_d.di_projid != fa->fsx_projid) { if (ip->i_projid != fa->fsx_projid) {
if (XFS_IS_QUOTA_RUNNING(mp) && XFS_IS_PQUOTA_ON(mp)) { if (XFS_IS_QUOTA_RUNNING(mp) && XFS_IS_PQUOTA_ON(mp)) {
olddquot = xfs_qm_vop_chown(tp, ip, olddquot = xfs_qm_vop_chown(tp, ip,
&ip->i_pdquot, pdqp); &ip->i_pdquot, pdqp);
} }
ip->i_d.di_projid = fa->fsx_projid; ip->i_projid = fa->fsx_projid;
} }
/* /*
......
...@@ -737,7 +737,7 @@ xfs_setattr_nonsize( ...@@ -737,7 +737,7 @@ xfs_setattr_nonsize(
*/ */
ASSERT(udqp == NULL); ASSERT(udqp == NULL);
ASSERT(gdqp == NULL); ASSERT(gdqp == NULL);
error = xfs_qm_vop_dqalloc(ip, uid, gid, ip->i_d.di_projid, error = xfs_qm_vop_dqalloc(ip, uid, gid, ip->i_projid,
qflags, &udqp, &gdqp, NULL); qflags, &udqp, &gdqp, NULL);
if (error) if (error)
return error; return error;
......
...@@ -86,7 +86,7 @@ xfs_bulkstat_one_int( ...@@ -86,7 +86,7 @@ xfs_bulkstat_one_int(
/* xfs_iget returns the following without needing /* xfs_iget returns the following without needing
* further change. * further change.
*/ */
buf->bs_projectid = ip->i_d.di_projid; buf->bs_projectid = ip->i_projid;
buf->bs_ino = ino; buf->bs_ino = ino;
buf->bs_uid = from_kuid(sb_userns, i_uid_into_mnt(mnt_userns, inode)); buf->bs_uid = from_kuid(sb_userns, i_uid_into_mnt(mnt_userns, inode));
buf->bs_gid = from_kgid(sb_userns, i_gid_into_mnt(mnt_userns, inode)); buf->bs_gid = from_kgid(sb_userns, i_gid_into_mnt(mnt_userns, inode));
......
...@@ -1716,7 +1716,7 @@ xfs_qm_vop_dqalloc( ...@@ -1716,7 +1716,7 @@ xfs_qm_vop_dqalloc(
} }
if ((flags & XFS_QMOPT_PQUOTA) && XFS_IS_PQUOTA_ON(mp)) { if ((flags & XFS_QMOPT_PQUOTA) && XFS_IS_PQUOTA_ON(mp)) {
ASSERT(O_pdqpp); ASSERT(O_pdqpp);
if (ip->i_d.di_projid != prid) { if (ip->i_projid != prid) {
xfs_iunlock(ip, lockflags); xfs_iunlock(ip, lockflags);
error = xfs_qm_dqget(mp, prid, error = xfs_qm_dqget(mp, prid,
XFS_DQTYPE_PROJ, true, &pq); XFS_DQTYPE_PROJ, true, &pq);
...@@ -1877,7 +1877,7 @@ xfs_qm_vop_create_dqattach( ...@@ -1877,7 +1877,7 @@ xfs_qm_vop_create_dqattach(
} }
if (pdqp && XFS_IS_PQUOTA_ON(mp)) { if (pdqp && XFS_IS_PQUOTA_ON(mp)) {
ASSERT(ip->i_pdquot == NULL); ASSERT(ip->i_pdquot == NULL);
ASSERT(ip->i_d.di_projid == pdqp->q_id); ASSERT(ip->i_projid == pdqp->q_id);
ip->i_pdquot = xfs_qm_dqhold(pdqp); ip->i_pdquot = xfs_qm_dqhold(pdqp);
xfs_trans_mod_dquot(tp, pdqp, XFS_TRANS_DQ_ICOUNT, 1); xfs_trans_mod_dquot(tp, pdqp, XFS_TRANS_DQ_ICOUNT, 1);
......
...@@ -60,7 +60,7 @@ xfs_qm_statvfs( ...@@ -60,7 +60,7 @@ xfs_qm_statvfs(
struct xfs_mount *mp = ip->i_mount; struct xfs_mount *mp = ip->i_mount;
struct xfs_dquot *dqp; struct xfs_dquot *dqp;
if (!xfs_qm_dqget(mp, ip->i_d.di_projid, XFS_DQTYPE_PROJ, false, &dqp)) { if (!xfs_qm_dqget(mp, ip->i_projid, XFS_DQTYPE_PROJ, false, &dqp)) {
xfs_fill_statvfs_from_dquot(statp, dqp); xfs_fill_statvfs_from_dquot(statp, dqp);
xfs_qm_dqput(dqp); xfs_qm_dqput(dqp);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment