Skip to content

Commit

Permalink
xfs: Define a new function xfs_is_quota_inode()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Chandra Seetharaman authored and Ben Myers committed Jun 28, 2013
1 parent dc037ad commit 9cad19d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion fs/xfs/xfs_itable.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
}

/*
Expand Down
8 changes: 3 additions & 5 deletions fs/xfs/xfs_qm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down
6 changes: 6 additions & 0 deletions fs/xfs/xfs_sb.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
6 changes: 2 additions & 4 deletions fs/xfs/xfs_trans_dquot.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)) ==
Expand Down

0 comments on commit 9cad19d

Please sign in to comment.