Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 307703
b: refs/heads/master
c: b4d05e3
h: refs/heads/master
i:
  307701: b6f5daf
  307699: c517374
  307695: 1b5d1cd
v: v3
  • Loading branch information
Christoph Hellwig authored and Ben Myers committed May 14, 2012
1 parent 9c5a2fc commit e9c404d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8a00ebe4cfc90eda9ecb575ba97e22021cd8cf70
refs/heads/master: b4d05e3019692fc5a8c573fbce60de2d48c5b7a1
26 changes: 21 additions & 5 deletions trunk/fs/xfs/xfs_qm.c
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,23 @@ xfs_qm_dqattach_grouphint(
xfs_dqunlock(udq);
}

static bool
xfs_qm_need_dqattach(
struct xfs_inode *ip)
{
struct xfs_mount *mp = ip->i_mount;

if (!XFS_IS_QUOTA_RUNNING(mp))
return false;
if (!XFS_IS_QUOTA_ON(mp))
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)
return false;
return true;
}

/*
* Given a locked inode, attach dquot(s) to it, taking U/G/P-QUOTAON
Expand All @@ -500,11 +517,7 @@ xfs_qm_dqattach_locked(
uint nquotas = 0;
int error = 0;

if (!XFS_IS_QUOTA_RUNNING(mp) ||
!XFS_IS_QUOTA_ON(mp) ||
!XFS_NOT_DQATTACHED(mp, ip) ||
ip->i_ino == mp->m_sb.sb_uquotino ||
ip->i_ino == mp->m_sb.sb_gquotino)
if (!xfs_qm_need_dqattach(ip))
return 0;

ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
Expand Down Expand Up @@ -575,6 +588,9 @@ xfs_qm_dqattach(
{
int error;

if (!xfs_qm_need_dqattach(ip))
return 0;

xfs_ilock(ip, XFS_ILOCK_EXCL);
error = xfs_qm_dqattach_locked(ip, flags);
xfs_iunlock(ip, XFS_ILOCK_EXCL);
Expand Down

0 comments on commit e9c404d

Please sign in to comment.