mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-20 05:31:15 +00:00
xfs: implement quota warnings via netlink
Wire up quota_send_warning to send quota warnings over netlink. This is used by various desktops to show user quota warnings. Tested by running the quota_nld daemon while running the xfstest quota tests and observing the warnings. I'll see how I can get a more formal testcase for it written. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <david@fromorbit.com> Signed-off-by: Alex Elder <aelder@sgi.com>
This commit is contained in:
parent
4d1f88d75b
commit
a210c1aa7f
1 changed files with 39 additions and 10 deletions
|
@ -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.
|
* This reserves disk blocks and inodes against a dquot.
|
||||||
* Flags indicate if the dquot is to be locked here and also
|
* Flags indicate if the dquot is to be locked here and also
|
||||||
|
@ -657,14 +671,22 @@ xfs_trans_dqresv(
|
||||||
* nblks.
|
* nblks.
|
||||||
*/
|
*/
|
||||||
if (hardlimit > 0ULL &&
|
if (hardlimit > 0ULL &&
|
||||||
hardlimit <= nblks + *resbcountp)
|
hardlimit <= nblks + *resbcountp) {
|
||||||
|
xfs_quota_warn(mp, dqp, QUOTA_NL_BHARDWARN);
|
||||||
goto error_return;
|
goto error_return;
|
||||||
|
}
|
||||||
if (softlimit > 0ULL &&
|
if (softlimit > 0ULL &&
|
||||||
softlimit <= nblks + *resbcountp &&
|
softlimit <= nblks + *resbcountp) {
|
||||||
((timer != 0 && get_seconds() > timer) ||
|
if ((timer != 0 && get_seconds() > timer) ||
|
||||||
(warns != 0 && warns >= warnlimit)))
|
(warns != 0 && warns >= warnlimit)) {
|
||||||
|
xfs_quota_warn(mp, dqp,
|
||||||
|
QUOTA_NL_BSOFTLONGWARN);
|
||||||
goto error_return;
|
goto error_return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xfs_quota_warn(mp, dqp, QUOTA_NL_BSOFTWARN);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (ninos > 0) {
|
if (ninos > 0) {
|
||||||
count = be64_to_cpu(dqp->q_core.d_icount);
|
count = be64_to_cpu(dqp->q_core.d_icount);
|
||||||
timer = be32_to_cpu(dqp->q_core.d_itimer);
|
timer = be32_to_cpu(dqp->q_core.d_itimer);
|
||||||
|
@ -677,13 +699,20 @@ xfs_trans_dqresv(
|
||||||
if (!softlimit)
|
if (!softlimit)
|
||||||
softlimit = q->qi_isoftlimit;
|
softlimit = q->qi_isoftlimit;
|
||||||
|
|
||||||
if (hardlimit > 0ULL && count >= hardlimit)
|
if (hardlimit > 0ULL && count >= hardlimit) {
|
||||||
|
xfs_quota_warn(mp, dqp, QUOTA_NL_IHARDWARN);
|
||||||
goto error_return;
|
goto error_return;
|
||||||
if (softlimit > 0ULL && count >= softlimit &&
|
}
|
||||||
((timer != 0 && get_seconds() > timer) ||
|
if (softlimit > 0ULL && count >= softlimit) {
|
||||||
(warns != 0 && warns >= warnlimit)))
|
if ((timer != 0 && get_seconds() > timer) ||
|
||||||
|
(warns != 0 && warns >= warnlimit)) {
|
||||||
|
xfs_quota_warn(mp, dqp,
|
||||||
|
QUOTA_NL_ISOFTLONGWARN);
|
||||||
goto error_return;
|
goto error_return;
|
||||||
}
|
}
|
||||||
|
xfs_quota_warn(mp, dqp, QUOTA_NL_ISOFTWARN);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue