Commit 9cad19d2 authored by Chandra Seetharaman's avatar Chandra Seetharaman Committed by Ben Myers

xfs: Define a new function xfs_is_quota_inode()

In preparation for combined pquota/gquota support, define
a new function to check if the given inode is a quota inode.
Signed-off-by: default avatarChandra Seetharaman <sekharan@us.ibm.com>
Reviewed-by: default avatarBen Myers <bpm@sgi.com>
Signed-off-by: default avatarBen Myers <bpm@sgi.com>
parent dc037ad7
...@@ -43,7 +43,7 @@ xfs_internal_inum( ...@@ -43,7 +43,7 @@ xfs_internal_inum(
{ {
return (ino == mp->m_sb.sb_rbmino || ino == mp->m_sb.sb_rsumino || return (ino == mp->m_sb.sb_rbmino || ino == mp->m_sb.sb_rsumino ||
(xfs_sb_version_hasquota(&mp->m_sb) && (xfs_sb_version_hasquota(&mp->m_sb) &&
(ino == mp->m_sb.sb_uquotino || ino == mp->m_sb.sb_gquotino))); xfs_is_quota_inode(&mp->m_sb, ino)));
} }
/* /*
......
...@@ -489,8 +489,7 @@ xfs_qm_need_dqattach( ...@@ -489,8 +489,7 @@ xfs_qm_need_dqattach(
return false; return false;
if (!XFS_NOT_DQATTACHED(mp, ip)) if (!XFS_NOT_DQATTACHED(mp, ip))
return false; return false;
if (ip->i_ino == mp->m_sb.sb_uquotino || if (xfs_is_quota_inode(&mp->m_sb, ip->i_ino))
ip->i_ino == mp->m_sb.sb_gquotino)
return false; return false;
return true; return true;
} }
...@@ -606,8 +605,7 @@ xfs_qm_dqdetach( ...@@ -606,8 +605,7 @@ xfs_qm_dqdetach(
trace_xfs_dquot_dqdetach(ip); trace_xfs_dquot_dqdetach(ip);
ASSERT(ip->i_ino != ip->i_mount->m_sb.sb_uquotino); ASSERT(!xfs_is_quota_inode(&ip->i_mount->m_sb, ip->i_ino));
ASSERT(ip->i_ino != ip->i_mount->m_sb.sb_gquotino);
if (ip->i_udquot) { if (ip->i_udquot) {
xfs_qm_dqrele(ip->i_udquot); xfs_qm_dqrele(ip->i_udquot);
ip->i_udquot = NULL; ip->i_udquot = NULL;
...@@ -1152,7 +1150,7 @@ xfs_qm_dqusage_adjust( ...@@ -1152,7 +1150,7 @@ xfs_qm_dqusage_adjust(
* rootino must have its resources accounted for, not so with the quota * rootino must have its resources accounted for, not so with the quota
* inodes. * inodes.
*/ */
if (ino == mp->m_sb.sb_uquotino || ino == mp->m_sb.sb_gquotino) { if (xfs_is_quota_inode(&mp->m_sb, ino)) {
*res = BULKSTAT_RV_NOTHING; *res = BULKSTAT_RV_NOTHING;
return XFS_ERROR(EINVAL); return XFS_ERROR(EINVAL);
} }
......
...@@ -618,6 +618,12 @@ xfs_sb_has_incompat_log_feature( ...@@ -618,6 +618,12 @@ xfs_sb_has_incompat_log_feature(
return (sbp->sb_features_log_incompat & feature) != 0; return (sbp->sb_features_log_incompat & feature) != 0;
} }
static inline bool
xfs_is_quota_inode(struct xfs_sb *sbp, xfs_ino_t ino)
{
return (ino == sbp->sb_uquotino || ino == sbp->sb_gquotino);
}
/* /*
* end of superblock version macros * end of superblock version macros
*/ */
......
...@@ -157,8 +157,7 @@ xfs_trans_mod_dquot_byino( ...@@ -157,8 +157,7 @@ xfs_trans_mod_dquot_byino(
if (!XFS_IS_QUOTA_RUNNING(mp) || if (!XFS_IS_QUOTA_RUNNING(mp) ||
!XFS_IS_QUOTA_ON(mp) || !XFS_IS_QUOTA_ON(mp) ||
ip->i_ino == mp->m_sb.sb_uquotino || xfs_is_quota_inode(&mp->m_sb, ip->i_ino))
ip->i_ino == mp->m_sb.sb_gquotino)
return; return;
if (tp->t_dqinfo == NULL) if (tp->t_dqinfo == NULL)
...@@ -816,8 +815,7 @@ xfs_trans_reserve_quota_nblks( ...@@ -816,8 +815,7 @@ xfs_trans_reserve_quota_nblks(
if (XFS_IS_PQUOTA_ON(mp)) if (XFS_IS_PQUOTA_ON(mp))
flags |= XFS_QMOPT_ENOSPC; flags |= XFS_QMOPT_ENOSPC;
ASSERT(ip->i_ino != mp->m_sb.sb_uquotino); ASSERT(!xfs_is_quota_inode(&mp->m_sb, ip->i_ino));
ASSERT(ip->i_ino != mp->m_sb.sb_gquotino);
ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
ASSERT((flags & ~(XFS_QMOPT_FORCE_RES | XFS_QMOPT_ENOSPC)) == ASSERT((flags & ~(XFS_QMOPT_FORCE_RES | XFS_QMOPT_ENOSPC)) ==
......
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