提交 d0a3fe67 编写于 作者: M Mitsuo Hayasaka 提交者: Ben Myers

xfs: change available ranges of softlimit and hardlimit in quota check

In general, quota allows us to use disk blocks and inodes up to each
limit, that is, they are available if they don't exceed their limitations.
Current xfs sets their available ranges to lower than them except disk
inode quota check. So, this patch changes the ranges to not beyond them.
Signed-off-by: NMitsuo Hayasaka <mitsuo.hayasaka.hu@hitachi.com>
Cc: Ben Myers <bpm@sgi.com>
Cc: Alex Elder <elder@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>
Reviewed-by: NChristoph Hellwig <hch@lst.de>
Reviewed-by: NMark Tinguely <tinguely@sgi.com>
Signed-off-by: NBen Myers <bpm@sgi.com>

(cherry picked from commit 20f12d8a)
上级 f65020a8
...@@ -139,10 +139,10 @@ xfs_qm_adjust_dqtimers( ...@@ -139,10 +139,10 @@ xfs_qm_adjust_dqtimers(
if (!d->d_btimer) { if (!d->d_btimer) {
if ((d->d_blk_softlimit && if ((d->d_blk_softlimit &&
(be64_to_cpu(d->d_bcount) >= (be64_to_cpu(d->d_bcount) >
be64_to_cpu(d->d_blk_softlimit))) || be64_to_cpu(d->d_blk_softlimit))) ||
(d->d_blk_hardlimit && (d->d_blk_hardlimit &&
(be64_to_cpu(d->d_bcount) >= (be64_to_cpu(d->d_bcount) >
be64_to_cpu(d->d_blk_hardlimit)))) { be64_to_cpu(d->d_blk_hardlimit)))) {
d->d_btimer = cpu_to_be32(get_seconds() + d->d_btimer = cpu_to_be32(get_seconds() +
mp->m_quotainfo->qi_btimelimit); mp->m_quotainfo->qi_btimelimit);
...@@ -151,10 +151,10 @@ xfs_qm_adjust_dqtimers( ...@@ -151,10 +151,10 @@ xfs_qm_adjust_dqtimers(
} }
} else { } else {
if ((!d->d_blk_softlimit || if ((!d->d_blk_softlimit ||
(be64_to_cpu(d->d_bcount) < (be64_to_cpu(d->d_bcount) <=
be64_to_cpu(d->d_blk_softlimit))) && be64_to_cpu(d->d_blk_softlimit))) &&
(!d->d_blk_hardlimit || (!d->d_blk_hardlimit ||
(be64_to_cpu(d->d_bcount) < (be64_to_cpu(d->d_bcount) <=
be64_to_cpu(d->d_blk_hardlimit)))) { be64_to_cpu(d->d_blk_hardlimit)))) {
d->d_btimer = 0; d->d_btimer = 0;
} }
...@@ -162,10 +162,10 @@ xfs_qm_adjust_dqtimers( ...@@ -162,10 +162,10 @@ xfs_qm_adjust_dqtimers(
if (!d->d_itimer) { if (!d->d_itimer) {
if ((d->d_ino_softlimit && if ((d->d_ino_softlimit &&
(be64_to_cpu(d->d_icount) >= (be64_to_cpu(d->d_icount) >
be64_to_cpu(d->d_ino_softlimit))) || be64_to_cpu(d->d_ino_softlimit))) ||
(d->d_ino_hardlimit && (d->d_ino_hardlimit &&
(be64_to_cpu(d->d_icount) >= (be64_to_cpu(d->d_icount) >
be64_to_cpu(d->d_ino_hardlimit)))) { be64_to_cpu(d->d_ino_hardlimit)))) {
d->d_itimer = cpu_to_be32(get_seconds() + d->d_itimer = cpu_to_be32(get_seconds() +
mp->m_quotainfo->qi_itimelimit); mp->m_quotainfo->qi_itimelimit);
...@@ -174,10 +174,10 @@ xfs_qm_adjust_dqtimers( ...@@ -174,10 +174,10 @@ xfs_qm_adjust_dqtimers(
} }
} else { } else {
if ((!d->d_ino_softlimit || if ((!d->d_ino_softlimit ||
(be64_to_cpu(d->d_icount) < (be64_to_cpu(d->d_icount) <=
be64_to_cpu(d->d_ino_softlimit))) && be64_to_cpu(d->d_ino_softlimit))) &&
(!d->d_ino_hardlimit || (!d->d_ino_hardlimit ||
(be64_to_cpu(d->d_icount) < (be64_to_cpu(d->d_icount) <=
be64_to_cpu(d->d_ino_hardlimit)))) { be64_to_cpu(d->d_ino_hardlimit)))) {
d->d_itimer = 0; d->d_itimer = 0;
} }
...@@ -185,10 +185,10 @@ xfs_qm_adjust_dqtimers( ...@@ -185,10 +185,10 @@ xfs_qm_adjust_dqtimers(
if (!d->d_rtbtimer) { if (!d->d_rtbtimer) {
if ((d->d_rtb_softlimit && if ((d->d_rtb_softlimit &&
(be64_to_cpu(d->d_rtbcount) >= (be64_to_cpu(d->d_rtbcount) >
be64_to_cpu(d->d_rtb_softlimit))) || be64_to_cpu(d->d_rtb_softlimit))) ||
(d->d_rtb_hardlimit && (d->d_rtb_hardlimit &&
(be64_to_cpu(d->d_rtbcount) >= (be64_to_cpu(d->d_rtbcount) >
be64_to_cpu(d->d_rtb_hardlimit)))) { be64_to_cpu(d->d_rtb_hardlimit)))) {
d->d_rtbtimer = cpu_to_be32(get_seconds() + d->d_rtbtimer = cpu_to_be32(get_seconds() +
mp->m_quotainfo->qi_rtbtimelimit); mp->m_quotainfo->qi_rtbtimelimit);
...@@ -197,10 +197,10 @@ xfs_qm_adjust_dqtimers( ...@@ -197,10 +197,10 @@ xfs_qm_adjust_dqtimers(
} }
} else { } else {
if ((!d->d_rtb_softlimit || if ((!d->d_rtb_softlimit ||
(be64_to_cpu(d->d_rtbcount) < (be64_to_cpu(d->d_rtbcount) <=
be64_to_cpu(d->d_rtb_softlimit))) && be64_to_cpu(d->d_rtb_softlimit))) &&
(!d->d_rtb_hardlimit || (!d->d_rtb_hardlimit ||
(be64_to_cpu(d->d_rtbcount) < (be64_to_cpu(d->d_rtbcount) <=
be64_to_cpu(d->d_rtb_hardlimit)))) { be64_to_cpu(d->d_rtb_hardlimit)))) {
d->d_rtbtimer = 0; d->d_rtbtimer = 0;
} }
......
...@@ -1981,7 +1981,7 @@ xfs_qm_dqcheck( ...@@ -1981,7 +1981,7 @@ xfs_qm_dqcheck(
if (!errs && ddq->d_id) { if (!errs && ddq->d_id) {
if (ddq->d_blk_softlimit && if (ddq->d_blk_softlimit &&
be64_to_cpu(ddq->d_bcount) >= be64_to_cpu(ddq->d_bcount) >
be64_to_cpu(ddq->d_blk_softlimit)) { be64_to_cpu(ddq->d_blk_softlimit)) {
if (!ddq->d_btimer) { if (!ddq->d_btimer) {
if (flags & XFS_QMOPT_DOWARN) if (flags & XFS_QMOPT_DOWARN)
...@@ -1992,7 +1992,7 @@ xfs_qm_dqcheck( ...@@ -1992,7 +1992,7 @@ xfs_qm_dqcheck(
} }
} }
if (ddq->d_ino_softlimit && if (ddq->d_ino_softlimit &&
be64_to_cpu(ddq->d_icount) >= be64_to_cpu(ddq->d_icount) >
be64_to_cpu(ddq->d_ino_softlimit)) { be64_to_cpu(ddq->d_ino_softlimit)) {
if (!ddq->d_itimer) { if (!ddq->d_itimer) {
if (flags & XFS_QMOPT_DOWARN) if (flags & XFS_QMOPT_DOWARN)
...@@ -2003,7 +2003,7 @@ xfs_qm_dqcheck( ...@@ -2003,7 +2003,7 @@ xfs_qm_dqcheck(
} }
} }
if (ddq->d_rtb_softlimit && if (ddq->d_rtb_softlimit &&
be64_to_cpu(ddq->d_rtbcount) >= be64_to_cpu(ddq->d_rtbcount) >
be64_to_cpu(ddq->d_rtb_softlimit)) { be64_to_cpu(ddq->d_rtb_softlimit)) {
if (!ddq->d_rtbtimer) { if (!ddq->d_rtbtimer) {
if (flags & XFS_QMOPT_DOWARN) if (flags & XFS_QMOPT_DOWARN)
......
...@@ -813,11 +813,11 @@ xfs_qm_export_dquot( ...@@ -813,11 +813,11 @@ xfs_qm_export_dquot(
(XFS_IS_OQUOTA_ENFORCED(mp) && (XFS_IS_OQUOTA_ENFORCED(mp) &&
(dst->d_flags & (FS_PROJ_QUOTA | FS_GROUP_QUOTA)))) && (dst->d_flags & (FS_PROJ_QUOTA | FS_GROUP_QUOTA)))) &&
dst->d_id != 0) { dst->d_id != 0) {
if (((int) dst->d_bcount >= (int) dst->d_blk_softlimit) && if (((int) dst->d_bcount > (int) dst->d_blk_softlimit) &&
(dst->d_blk_softlimit > 0)) { (dst->d_blk_softlimit > 0)) {
ASSERT(dst->d_btimer != 0); ASSERT(dst->d_btimer != 0);
} }
if (((int) dst->d_icount >= (int) dst->d_ino_softlimit) && if (((int) dst->d_icount > (int) dst->d_ino_softlimit) &&
(dst->d_ino_softlimit > 0)) { (dst->d_ino_softlimit > 0)) {
ASSERT(dst->d_itimer != 0); ASSERT(dst->d_itimer != 0);
} }
......
...@@ -649,12 +649,12 @@ xfs_trans_dqresv( ...@@ -649,12 +649,12 @@ 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); 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) {
if ((timer != 0 && get_seconds() > timer) || if ((timer != 0 && get_seconds() > timer) ||
(warns != 0 && warns >= warnlimit)) { (warns != 0 && warns >= warnlimit)) {
xfs_quota_warn(mp, dqp, xfs_quota_warn(mp, dqp,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册