summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_trans_dquot.c
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2020-07-14 10:37:30 -0700
committerDarrick J. Wong <darrick.wong@oracle.com>2020-07-28 20:24:14 -0700
commit784e80f5640db9a925af1143a25e9bb98624350d (patch)
treedf84e90d560fd643d4f02d43cb5002f28bbcf15e /fs/xfs/xfs_trans_dquot.c
parentc51df7334167e445f2cafc5511d6e2407a32e8f1 (diff)
xfs: use a per-resource struct for incore dquot data
Introduce a new struct xfs_dquot_res that we'll use to track all the incore data for a particular resource type (block, inode, rt block). This will help us (once we've eliminated q_core) to declutter quota functions that currently open-code field access or pass around fields around explicitly. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Allison Collins <allison.henderson@oracle.com>
Diffstat (limited to 'fs/xfs/xfs_trans_dquot.c')
-rw-r--r--fs/xfs/xfs_trans_dquot.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/fs/xfs/xfs_trans_dquot.c b/fs/xfs/xfs_trans_dquot.c
index 8dd6aa6e8fa3..ed3928e9392f 100644
--- a/fs/xfs/xfs_trans_dquot.c
+++ b/fs/xfs/xfs_trans_dquot.c
@@ -409,11 +409,11 @@ xfs_trans_apply_dquot_deltas(
if (qtrx->qt_blk_res != blk_res_used) {
if (qtrx->qt_blk_res > blk_res_used)
- dqp->q_res_bcount -= (xfs_qcnt_t)
+ dqp->q_blk.reserved -= (xfs_qcnt_t)
(qtrx->qt_blk_res -
blk_res_used);
else
- dqp->q_res_bcount -= (xfs_qcnt_t)
+ dqp->q_blk.reserved -= (xfs_qcnt_t)
(blk_res_used -
qtrx->qt_blk_res);
}
@@ -426,7 +426,7 @@ xfs_trans_apply_dquot_deltas(
* deliberately skip quota reservations.
*/
if (qtrx->qt_bcount_delta) {
- dqp->q_res_bcount +=
+ dqp->q_blk.reserved +=
(xfs_qcnt_t)qtrx->qt_bcount_delta;
}
}
@@ -437,17 +437,17 @@ xfs_trans_apply_dquot_deltas(
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)
+ dqp->q_rtb.reserved -= (xfs_qcnt_t)
(qtrx->qt_rtblk_res -
qtrx->qt_rtblk_res_used);
else
- dqp->q_res_rtbcount -= (xfs_qcnt_t)
+ dqp->q_rtb.reserved -= (xfs_qcnt_t)
(qtrx->qt_rtblk_res_used -
qtrx->qt_rtblk_res);
}
} else {
if (qtrx->qt_rtbcount_delta)
- dqp->q_res_rtbcount +=
+ dqp->q_rtb.reserved +=
(xfs_qcnt_t)qtrx->qt_rtbcount_delta;
}
@@ -458,20 +458,20 @@ xfs_trans_apply_dquot_deltas(
ASSERT(qtrx->qt_ino_res >=
qtrx->qt_ino_res_used);
if (qtrx->qt_ino_res > qtrx->qt_ino_res_used)
- dqp->q_res_icount -= (xfs_qcnt_t)
+ dqp->q_ino.reserved -= (xfs_qcnt_t)
(qtrx->qt_ino_res -
qtrx->qt_ino_res_used);
} else {
if (qtrx->qt_icount_delta)
- dqp->q_res_icount +=
+ dqp->q_ino.reserved +=
(xfs_qcnt_t)qtrx->qt_icount_delta;
}
- ASSERT(dqp->q_res_bcount >=
+ ASSERT(dqp->q_blk.reserved >=
be64_to_cpu(dqp->q_core.d_bcount));
- ASSERT(dqp->q_res_icount >=
+ ASSERT(dqp->q_ino.reserved >=
be64_to_cpu(dqp->q_core.d_icount));
- ASSERT(dqp->q_res_rtbcount >=
+ ASSERT(dqp->q_rtb.reserved >=
be64_to_cpu(dqp->q_core.d_rtbcount));
}
}
@@ -516,7 +516,7 @@ xfs_trans_unreserve_and_mod_dquots(
if (qtrx->qt_blk_res) {
xfs_dqlock(dqp);
locked = true;
- dqp->q_res_bcount -=
+ dqp->q_blk.reserved -=
(xfs_qcnt_t)qtrx->qt_blk_res;
}
if (qtrx->qt_ino_res) {
@@ -524,7 +524,7 @@ xfs_trans_unreserve_and_mod_dquots(
xfs_dqlock(dqp);
locked = true;
}
- dqp->q_res_icount -=
+ dqp->q_ino.reserved -=
(xfs_qcnt_t)qtrx->qt_ino_res;
}
@@ -533,7 +533,7 @@ xfs_trans_unreserve_and_mod_dquots(
xfs_dqlock(dqp);
locked = true;
}
- dqp->q_res_rtbcount -=
+ dqp->q_rtb.reserved -=
(xfs_qcnt_t)qtrx->qt_rtblk_res;
}
if (locked)
@@ -602,7 +602,7 @@ xfs_trans_dqresv(
timer = be32_to_cpu(dqp->q_core.d_btimer);
warns = be16_to_cpu(dqp->q_core.d_bwarns);
warnlimit = defq->bwarnlimit;
- resbcountp = &dqp->q_res_bcount;
+ resbcountp = &dqp->q_blk.reserved;
} else {
ASSERT(flags & XFS_TRANS_DQ_RES_RTBLKS);
hardlimit = be64_to_cpu(dqp->q_core.d_rtb_hardlimit);
@@ -614,7 +614,7 @@ xfs_trans_dqresv(
timer = be32_to_cpu(dqp->q_core.d_rtbtimer);
warns = be16_to_cpu(dqp->q_core.d_rtbwarns);
warnlimit = defq->rtbwarnlimit;
- resbcountp = &dqp->q_res_rtbcount;
+ resbcountp = &dqp->q_rtb.reserved;
}
if ((flags & XFS_QMOPT_FORCE_RES) == 0 && dqp->q_id &&
@@ -645,7 +645,7 @@ xfs_trans_dqresv(
}
}
if (ninos > 0) {
- total_count = dqp->q_res_icount + ninos;
+ total_count = dqp->q_ino.reserved + ninos;
timer = be32_to_cpu(dqp->q_core.d_itimer);
warns = be16_to_cpu(dqp->q_core.d_iwarns);
warnlimit = defq->iwarnlimit;
@@ -675,11 +675,11 @@ xfs_trans_dqresv(
/*
* Change the reservation, but not the actual usage.
- * Note that q_res_bcount = q_core.d_bcount + resv
+ * Note that q_blk.reserved = q_core.d_bcount + resv
*/
(*resbcountp) += (xfs_qcnt_t)nblks;
if (ninos != 0)
- dqp->q_res_icount += (xfs_qcnt_t)ninos;
+ dqp->q_ino.reserved += (xfs_qcnt_t)ninos;
/*
* note the reservation amt in the trans struct too,
@@ -700,9 +700,9 @@ xfs_trans_dqresv(
XFS_TRANS_DQ_RES_INOS,
ninos);
}
- ASSERT(dqp->q_res_bcount >= be64_to_cpu(dqp->q_core.d_bcount));
- ASSERT(dqp->q_res_rtbcount >= be64_to_cpu(dqp->q_core.d_rtbcount));
- ASSERT(dqp->q_res_icount >= be64_to_cpu(dqp->q_core.d_icount));
+ ASSERT(dqp->q_blk.reserved >= be64_to_cpu(dqp->q_core.d_bcount));
+ ASSERT(dqp->q_rtb.reserved >= be64_to_cpu(dqp->q_core.d_rtbcount));
+ ASSERT(dqp->q_ino.reserved >= be64_to_cpu(dqp->q_core.d_icount));
xfs_dqunlock(dqp);
return 0;