Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 181806
b: refs/heads/master
c: a210c1a
h: refs/heads/master
v: v3
  • Loading branch information
Christoph Hellwig authored and Alex Elder committed Jan 21, 2010
1 parent 0f7c9dc commit 89277c4
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 11 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: 4d1f88d75b00c4d23f4c51305ab5b779a86ef74e
refs/heads/master: a210c1aa7f6c90b729cc3a72d03e789b13cb6c47
49 changes: 39 additions & 10 deletions trunk/fs/xfs/quota/xfs_trans_dquot.c
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,20 @@ xfs_trans_unreserve_and_mod_dquots(
}
}

STATIC void
xfs_quota_warn(
struct xfs_mount *mp,
struct xfs_dquot *dqp,
int type)
{
/* no warnings for project quotas - we just return ENOSPC later */
if (dqp->dq_flags & XFS_DQ_PROJ)
return;
quota_send_warning((dqp->dq_flags & XFS_DQ_USER) ? USRQUOTA : GRPQUOTA,
be32_to_cpu(dqp->q_core.d_id), mp->m_super->s_dev,
type);
}

/*
* This reserves disk blocks and inodes against a dquot.
* Flags indicate if the dquot is to be locked here and also
Expand Down Expand Up @@ -657,13 +671,21 @@ xfs_trans_dqresv(
* nblks.
*/
if (hardlimit > 0ULL &&
hardlimit <= nblks + *resbcountp)
hardlimit <= nblks + *resbcountp) {
xfs_quota_warn(mp, dqp, QUOTA_NL_BHARDWARN);
goto error_return;
}
if (softlimit > 0ULL &&
softlimit <= nblks + *resbcountp &&
((timer != 0 && get_seconds() > timer) ||
(warns != 0 && warns >= warnlimit)))
goto error_return;
softlimit <= nblks + *resbcountp) {
if ((timer != 0 && get_seconds() > timer) ||
(warns != 0 && warns >= warnlimit)) {
xfs_quota_warn(mp, dqp,
QUOTA_NL_BSOFTLONGWARN);
goto error_return;
}

xfs_quota_warn(mp, dqp, QUOTA_NL_BSOFTWARN);
}
}
if (ninos > 0) {
count = be64_to_cpu(dqp->q_core.d_icount);
Expand All @@ -677,12 +699,19 @@ xfs_trans_dqresv(
if (!softlimit)
softlimit = q->qi_isoftlimit;

if (hardlimit > 0ULL && count >= hardlimit)
goto error_return;
if (softlimit > 0ULL && count >= softlimit &&
((timer != 0 && get_seconds() > timer) ||
(warns != 0 && warns >= warnlimit)))
if (hardlimit > 0ULL && count >= hardlimit) {
xfs_quota_warn(mp, dqp, QUOTA_NL_IHARDWARN);
goto error_return;
}
if (softlimit > 0ULL && count >= softlimit) {
if ((timer != 0 && get_seconds() > timer) ||
(warns != 0 && warns >= warnlimit)) {
xfs_quota_warn(mp, dqp,
QUOTA_NL_ISOFTLONGWARN);
goto error_return;
}
xfs_quota_warn(mp, dqp, QUOTA_NL_ISOFTWARN);
}
}
}

Expand Down

0 comments on commit 89277c4

Please sign in to comment.