xfs: Define a new function xfs_is_quota_inode()
authorChandra Seetharaman <sekharan@us.ibm.com>
Thu, 27 Jun 2013 22:25:04 +0000 (17:25 -0500)
committerBen Myers <bpm@sgi.com>
Fri, 28 Jun 2013 18:03:49 +0000 (13:03 -0500)
In preparation for combined pquota/gquota support, define
a new function to check if the given inode is a quota inode.

Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com>
Reviewed-by: Ben Myers <bpm@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
fs/xfs/xfs_itable.c
fs/xfs/xfs_qm.c
fs/xfs/xfs_sb.h
fs/xfs/xfs_trans_dquot.c

index 06d004d85bf45a086e1e63c49eca9220a0d7e53f..bc92c5306a170afd58ca55945bc9471287933699 100644 (file)
@@ -43,7 +43,7 @@ xfs_internal_inum(
 {
        return (ino == mp->m_sb.sb_rbmino || ino == mp->m_sb.sb_rsumino ||
                (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)));
 }
 
 /*
index b75c9bb6e71e34b0c65158f63ba475a217d9e347..28a5e8ae3829dfb2918edb057bf2406211f9568f 100644 (file)
@@ -489,8 +489,7 @@ xfs_qm_need_dqattach(
                return false;
        if (!XFS_NOT_DQATTACHED(mp, ip))
                return false;
-       if (ip->i_ino == mp->m_sb.sb_uquotino ||
-           ip->i_ino == mp->m_sb.sb_gquotino)
+       if (xfs_is_quota_inode(&mp->m_sb, ip->i_ino))
                return false;
        return true;
 }
@@ -606,8 +605,7 @@ xfs_qm_dqdetach(
 
        trace_xfs_dquot_dqdetach(ip);
 
-       ASSERT(ip->i_ino != ip->i_mount->m_sb.sb_uquotino);
-       ASSERT(ip->i_ino != ip->i_mount->m_sb.sb_gquotino);
+       ASSERT(!xfs_is_quota_inode(&ip->i_mount->m_sb, ip->i_ino));
        if (ip->i_udquot) {
                xfs_qm_dqrele(ip->i_udquot);
                ip->i_udquot = NULL;
@@ -1152,7 +1150,7 @@ xfs_qm_dqusage_adjust(
         * rootino must have its resources accounted for, not so with the quota
         * 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;
                return XFS_ERROR(EINVAL);
        }
index 2de58a85833c273d49baea1db168192f0c409120..78f9e70b80c7da8a64b92d528a9f7aa2ba49401e 100644 (file)
@@ -618,6 +618,12 @@ xfs_sb_has_incompat_log_feature(
        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
  */
index fec75d0237031a5d030f2bbaa7057ecc0f28092a..3fa369c75a4d3939431606b74cd24eff3c64ce4b 100644 (file)
@@ -157,8 +157,7 @@ xfs_trans_mod_dquot_byino(
 
        if (!XFS_IS_QUOTA_RUNNING(mp) ||
            !XFS_IS_QUOTA_ON(mp) ||
-           ip->i_ino == mp->m_sb.sb_uquotino ||
-           ip->i_ino == mp->m_sb.sb_gquotino)
+           xfs_is_quota_inode(&mp->m_sb, ip->i_ino))
                return;
 
        if (tp->t_dqinfo == NULL)
@@ -816,8 +815,7 @@ xfs_trans_reserve_quota_nblks(
        if (XFS_IS_PQUOTA_ON(mp))
                flags |= XFS_QMOPT_ENOSPC;
 
-       ASSERT(ip->i_ino != mp->m_sb.sb_uquotino);
-       ASSERT(ip->i_ino != mp->m_sb.sb_gquotino);
+       ASSERT(!xfs_is_quota_inode(&mp->m_sb, ip->i_ino));
 
        ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
        ASSERT((flags & ~(XFS_QMOPT_FORCE_RES | XFS_QMOPT_ENOSPC)) ==