[XFS] Merge fixes into realtime quota code, since one/two reported, still
not enabled though. SGI-PV: 938145 SGI-Modid: xfs-linux:xfs-kern:22900a Signed-off-by: Nathan Scott <nathans@sgi.com>
This commit is contained in:
@@ -1251,6 +1251,10 @@ xfs_qm_init_quotainfo(
|
||||
INT_GET(ddqp->d_iwarns, ARCH_CONVERT) ?
|
||||
INT_GET(ddqp->d_iwarns, ARCH_CONVERT) :
|
||||
XFS_QM_IWARNLIMIT;
|
||||
qinf->qi_rtbwarnlimit =
|
||||
INT_GET(ddqp->d_rtbwarns, ARCH_CONVERT) ?
|
||||
INT_GET(ddqp->d_rtbwarns, ARCH_CONVERT) :
|
||||
XFS_QM_RTBWARNLIMIT;
|
||||
qinf->qi_bhardlimit =
|
||||
INT_GET(ddqp->d_blk_hardlimit, ARCH_CONVERT);
|
||||
qinf->qi_bsoftlimit =
|
||||
@@ -1276,6 +1280,7 @@ xfs_qm_init_quotainfo(
|
||||
qinf->qi_rtbtimelimit = XFS_QM_RTBTIMELIMIT;
|
||||
qinf->qi_bwarnlimit = XFS_QM_BWARNLIMIT;
|
||||
qinf->qi_iwarnlimit = XFS_QM_IWARNLIMIT;
|
||||
qinf->qi_rtbwarnlimit = XFS_QM_RTBWARNLIMIT;
|
||||
}
|
||||
|
||||
return (0);
|
||||
@@ -2624,6 +2629,9 @@ xfs_qm_vop_chown(
|
||||
xfs_dquot_t *newdq)
|
||||
{
|
||||
xfs_dquot_t *prevdq;
|
||||
uint bfield = XFS_IS_REALTIME_INODE(ip) ?
|
||||
XFS_TRANS_DQ_RTBCOUNT : XFS_TRANS_DQ_BCOUNT;
|
||||
|
||||
ASSERT(XFS_ISLOCKED_INODE_EXCL(ip));
|
||||
ASSERT(XFS_IS_QUOTA_RUNNING(ip->i_mount));
|
||||
|
||||
@@ -2632,20 +2640,12 @@ xfs_qm_vop_chown(
|
||||
ASSERT(prevdq);
|
||||
ASSERT(prevdq != newdq);
|
||||
|
||||
xfs_trans_mod_dquot(tp, prevdq,
|
||||
XFS_TRANS_DQ_BCOUNT,
|
||||
-(ip->i_d.di_nblocks));
|
||||
xfs_trans_mod_dquot(tp, prevdq,
|
||||
XFS_TRANS_DQ_ICOUNT,
|
||||
-1);
|
||||
xfs_trans_mod_dquot(tp, prevdq, bfield, -(ip->i_d.di_nblocks));
|
||||
xfs_trans_mod_dquot(tp, prevdq, XFS_TRANS_DQ_ICOUNT, -1);
|
||||
|
||||
/* the sparkling new dquot */
|
||||
xfs_trans_mod_dquot(tp, newdq,
|
||||
XFS_TRANS_DQ_BCOUNT,
|
||||
ip->i_d.di_nblocks);
|
||||
xfs_trans_mod_dquot(tp, newdq,
|
||||
XFS_TRANS_DQ_ICOUNT,
|
||||
1);
|
||||
xfs_trans_mod_dquot(tp, newdq, bfield, ip->i_d.di_nblocks);
|
||||
xfs_trans_mod_dquot(tp, newdq, XFS_TRANS_DQ_ICOUNT, 1);
|
||||
|
||||
/*
|
||||
* Take an extra reference, because the inode
|
||||
@@ -2673,7 +2673,7 @@ xfs_qm_vop_chown_reserve(
|
||||
{
|
||||
int error;
|
||||
xfs_mount_t *mp;
|
||||
uint delblks;
|
||||
uint delblks, blkflags;
|
||||
xfs_dquot_t *unresudq, *unresgdq, *delblksudq, *delblksgdq;
|
||||
|
||||
ASSERT(XFS_ISLOCKED_INODE(ip));
|
||||
@@ -2682,6 +2682,8 @@ xfs_qm_vop_chown_reserve(
|
||||
|
||||
delblks = ip->i_delayed_blks;
|
||||
delblksudq = delblksgdq = unresudq = unresgdq = NULL;
|
||||
blkflags = XFS_IS_REALTIME_INODE(ip) ?
|
||||
XFS_QMOPT_RES_RTBLKS : XFS_QMOPT_RES_REGBLKS;
|
||||
|
||||
if (XFS_IS_UQUOTA_ON(mp) && udqp &&
|
||||
ip->i_d.di_uid != (uid_t)INT_GET(udqp->q_core.d_id, ARCH_CONVERT)) {
|
||||
@@ -2711,7 +2713,7 @@ xfs_qm_vop_chown_reserve(
|
||||
|
||||
if ((error = xfs_trans_reserve_quota_bydquots(tp, ip->i_mount,
|
||||
delblksudq, delblksgdq, ip->i_d.di_nblocks, 1,
|
||||
flags | XFS_QMOPT_RES_REGBLKS)))
|
||||
flags | blkflags)))
|
||||
return (error);
|
||||
|
||||
/*
|
||||
@@ -2728,11 +2730,11 @@ xfs_qm_vop_chown_reserve(
|
||||
ASSERT(unresudq || unresgdq);
|
||||
if ((error = xfs_trans_reserve_quota_bydquots(NULL, ip->i_mount,
|
||||
delblksudq, delblksgdq, (xfs_qcnt_t)delblks, 0,
|
||||
flags | XFS_QMOPT_RES_REGBLKS)))
|
||||
flags | blkflags)))
|
||||
return (error);
|
||||
xfs_trans_reserve_quota_bydquots(NULL, ip->i_mount,
|
||||
unresudq, unresgdq, -((xfs_qcnt_t)delblks), 0,
|
||||
XFS_QMOPT_RES_REGBLKS);
|
||||
blkflags);
|
||||
}
|
||||
|
||||
return (0);
|
||||
|
@@ -133,8 +133,9 @@ typedef struct xfs_quotainfo {
|
||||
time_t qi_btimelimit; /* limit for blks timer */
|
||||
time_t qi_itimelimit; /* limit for inodes timer */
|
||||
time_t qi_rtbtimelimit;/* limit for rt blks timer */
|
||||
xfs_qwarncnt_t qi_bwarnlimit; /* limit for num warnings */
|
||||
xfs_qwarncnt_t qi_iwarnlimit; /* limit for num warnings */
|
||||
xfs_qwarncnt_t qi_bwarnlimit; /* limit for blks warnings */
|
||||
xfs_qwarncnt_t qi_iwarnlimit; /* limit for inodes warnings */
|
||||
xfs_qwarncnt_t qi_rtbwarnlimit;/* limit for rt blks warnings */
|
||||
mutex_t qi_quotaofflock;/* to serialize quotaoff */
|
||||
xfs_filblks_t qi_dqchunklen; /* # BBs in a chunk of dqs */
|
||||
uint qi_dqperchunk; /* # ondisk dqs in above chunk */
|
||||
@@ -176,6 +177,7 @@ typedef struct xfs_dquot_acct {
|
||||
|
||||
#define XFS_QM_BWARNLIMIT 5
|
||||
#define XFS_QM_IWARNLIMIT 5
|
||||
#define XFS_QM_RTBWARNLIMIT 5
|
||||
|
||||
#define XFS_QM_LOCK(xqm) (mutex_lock(&xqm##_lock, PINOD))
|
||||
#define XFS_QM_UNLOCK(xqm) (mutex_unlock(&xqm##_lock))
|
||||
|
@@ -56,6 +56,7 @@
|
||||
#define XFS_QI_RTBTIMELIMIT(mp) ((mp)->m_quotainfo->qi_rtbtimelimit)
|
||||
#define XFS_QI_ITIMELIMIT(mp) ((mp)->m_quotainfo->qi_itimelimit)
|
||||
#define XFS_QI_BWARNLIMIT(mp) ((mp)->m_quotainfo->qi_bwarnlimit)
|
||||
#define XFS_QI_RTBWARNLIMIT(mp) ((mp)->m_quotainfo->qi_rtbwarnlimit)
|
||||
#define XFS_QI_IWARNLIMIT(mp) ((mp)->m_quotainfo->qi_iwarnlimit)
|
||||
#define XFS_QI_QOFFLOCK(mp) ((mp)->m_quotainfo->qi_quotaofflock)
|
||||
|
||||
|
@@ -497,7 +497,7 @@ xfs_trans_apply_dquot_deltas(
|
||||
* Adjust the RT reservation.
|
||||
*/
|
||||
if (qtrx->qt_rtblk_res != 0) {
|
||||
if (qtrx->qt_blk_res != qtrx->qt_blk_res_used) {
|
||||
if (qtrx->qt_rtblk_res != qtrx->qt_rtblk_res_used) {
|
||||
if (qtrx->qt_rtblk_res >
|
||||
qtrx->qt_rtblk_res_used)
|
||||
dqp->q_res_rtbcount -= (xfs_qcnt_t)
|
||||
@@ -530,12 +530,6 @@ xfs_trans_apply_dquot_deltas(
|
||||
(xfs_qcnt_t)qtrx->qt_icount_delta;
|
||||
}
|
||||
|
||||
|
||||
#ifdef QUOTADEBUG
|
||||
if (qtrx->qt_rtblk_res != 0)
|
||||
cmn_err(CE_DEBUG, "RT res %d for 0x%p\n",
|
||||
(int) qtrx->qt_rtblk_res, dqp);
|
||||
#endif
|
||||
ASSERT(dqp->q_res_bcount >=
|
||||
INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT));
|
||||
ASSERT(dqp->q_res_icount >=
|
||||
@@ -636,7 +630,10 @@ xfs_trans_dqresv(
|
||||
int error;
|
||||
xfs_qcnt_t hardlimit;
|
||||
xfs_qcnt_t softlimit;
|
||||
time_t btimer;
|
||||
time_t timer;
|
||||
xfs_qwarncnt_t warns;
|
||||
xfs_qwarncnt_t warnlimit;
|
||||
xfs_qcnt_t count;
|
||||
xfs_qcnt_t *resbcountp;
|
||||
xfs_quotainfo_t *q = mp->m_quotainfo;
|
||||
|
||||
@@ -651,7 +648,9 @@ xfs_trans_dqresv(
|
||||
softlimit = INT_GET(dqp->q_core.d_blk_softlimit, ARCH_CONVERT);
|
||||
if (!softlimit)
|
||||
softlimit = q->qi_bsoftlimit;
|
||||
btimer = INT_GET(dqp->q_core.d_btimer, ARCH_CONVERT);
|
||||
timer = INT_GET(dqp->q_core.d_btimer, ARCH_CONVERT);
|
||||
warns = INT_GET(dqp->q_core.d_bwarns, ARCH_CONVERT);
|
||||
warnlimit = XFS_QI_BWARNLIMIT(dqp->q_mount);
|
||||
resbcountp = &dqp->q_res_bcount;
|
||||
} else {
|
||||
ASSERT(flags & XFS_TRANS_DQ_RES_RTBLKS);
|
||||
@@ -661,7 +660,9 @@ xfs_trans_dqresv(
|
||||
softlimit = INT_GET(dqp->q_core.d_rtb_softlimit, ARCH_CONVERT);
|
||||
if (!softlimit)
|
||||
softlimit = q->qi_rtbsoftlimit;
|
||||
btimer = INT_GET(dqp->q_core.d_rtbtimer, ARCH_CONVERT);
|
||||
timer = INT_GET(dqp->q_core.d_rtbtimer, ARCH_CONVERT);
|
||||
warns = INT_GET(dqp->q_core.d_rtbwarns, ARCH_CONVERT);
|
||||
warnlimit = XFS_QI_RTBWARNLIMIT(dqp->q_mount);
|
||||
resbcountp = &dqp->q_res_rtbcount;
|
||||
}
|
||||
error = 0;
|
||||
@@ -691,37 +692,36 @@ xfs_trans_dqresv(
|
||||
* If timer or warnings has expired,
|
||||
* return EDQUOT
|
||||
*/
|
||||
if ((btimer != 0 && get_seconds() > btimer) ||
|
||||
(dqp->q_core.d_bwarns &&
|
||||
INT_GET(dqp->q_core.d_bwarns, ARCH_CONVERT) >=
|
||||
XFS_QI_BWARNLIMIT(dqp->q_mount))) {
|
||||
if ((timer != 0 && get_seconds() > timer) ||
|
||||
(warns != 0 && warns >= warnlimit)) {
|
||||
error = EDQUOT;
|
||||
goto error_return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ninos > 0) {
|
||||
hardlimit = INT_GET(dqp->q_core.d_ino_hardlimit, ARCH_CONVERT);
|
||||
count = INT_GET(dqp->q_core.d_icount, ARCH_CONVERT);
|
||||
timer = INT_GET(dqp->q_core.d_itimer, ARCH_CONVERT);
|
||||
warns = INT_GET(dqp->q_core.d_iwarns, ARCH_CONVERT);
|
||||
warnlimit = XFS_QI_IWARNLIMIT(dqp->q_mount);
|
||||
hardlimit = INT_GET(dqp->q_core.d_ino_hardlimit,
|
||||
ARCH_CONVERT);
|
||||
if (!hardlimit)
|
||||
hardlimit = q->qi_ihardlimit;
|
||||
softlimit = INT_GET(dqp->q_core.d_ino_softlimit, ARCH_CONVERT);
|
||||
softlimit = INT_GET(dqp->q_core.d_ino_softlimit,
|
||||
ARCH_CONVERT);
|
||||
if (!softlimit)
|
||||
softlimit = q->qi_isoftlimit;
|
||||
if (hardlimit > 0ULL &&
|
||||
INT_GET(dqp->q_core.d_icount, ARCH_CONVERT) >= hardlimit) {
|
||||
if (hardlimit > 0ULL && count >= hardlimit) {
|
||||
error = EDQUOT;
|
||||
goto error_return;
|
||||
} else if (softlimit > 0ULL &&
|
||||
INT_GET(dqp->q_core.d_icount, ARCH_CONVERT) >= softlimit) {
|
||||
} else if (softlimit > 0ULL && count >= softlimit) {
|
||||
/*
|
||||
* If timer or warnings has expired,
|
||||
* return EDQUOT
|
||||
*/
|
||||
if ((dqp->q_core.d_itimer &&
|
||||
get_seconds() > INT_GET(dqp->q_core.d_itimer, ARCH_CONVERT)) ||
|
||||
(dqp->q_core.d_iwarns &&
|
||||
INT_GET(dqp->q_core.d_iwarns, ARCH_CONVERT) >=
|
||||
XFS_QI_IWARNLIMIT(dqp->q_mount))) {
|
||||
if ((timer != 0 && get_seconds() > timer) ||
|
||||
(warns != 0 && warns >= warnlimit)) {
|
||||
error = EDQUOT;
|
||||
goto error_return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user