aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorChandra Seetharaman <sekharan@us.ibm.com>2013-06-27 18:25:09 -0400
committerBen Myers <bpm@sgi.com>2013-06-28 15:12:22 -0400
commit0e6436d99e730f9384f3c11d24a5efb788885fc6 (patch)
tree9cd43465189082c83ec9c2cb16e74f44f0d938c0 /fs/xfs
parent113a56835d938d5cf9b4599053da7afb80d6f710 (diff)
xfs: Change xfs_dquot_acct to be a 2-dimensional array
In preparation for combined pquota/gquota support, for the sake of readability, change xfs_dquot_acct to be a 2-dimensional array. Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com> Reviewed-by: Ben Myers <bpm@sgi.com> Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/xfs_qm.h12
-rw-r--r--fs/xfs/xfs_trans_dquot.c31
2 files changed, 20 insertions, 23 deletions
diff --git a/fs/xfs/xfs_qm.h b/fs/xfs/xfs_qm.h
index 978bbb1a9e77..bdb4f8b95207 100644
--- a/fs/xfs/xfs_qm.h
+++ b/fs/xfs/xfs_qm.h
@@ -116,11 +116,15 @@ extern void xfs_trans_log_dquot(struct xfs_trans *, struct xfs_dquot *);
116 * to do at commit time. All transactions that we know of at this point 116 * to do at commit time. All transactions that we know of at this point
117 * affect no more than two dquots of one type. Hence, the TRANS_MAXDQS value. 117 * affect no more than two dquots of one type. Hence, the TRANS_MAXDQS value.
118 */ 118 */
119enum {
120 XFS_QM_TRANS_USR = 0,
121 XFS_QM_TRANS_GRP,
122 XFS_QM_TRANS_DQTYPES
123};
119#define XFS_QM_TRANS_MAXDQS 2 124#define XFS_QM_TRANS_MAXDQS 2
120typedef struct xfs_dquot_acct { 125struct xfs_dquot_acct {
121 xfs_dqtrx_t dqa_usrdquots[XFS_QM_TRANS_MAXDQS]; 126 struct xfs_dqtrx dqs[XFS_QM_TRANS_DQTYPES][XFS_QM_TRANS_MAXDQS];
122 xfs_dqtrx_t dqa_grpdquots[XFS_QM_TRANS_MAXDQS]; 127};
123} xfs_dquot_acct_t;
124 128
125/* 129/*
126 * Users are allowed to have a usage exceeding their softlimit for 130 * Users are allowed to have a usage exceeding their softlimit for
diff --git a/fs/xfs/xfs_trans_dquot.c b/fs/xfs/xfs_trans_dquot.c
index 45b3e2d0773a..7ea7485f9fb8 100644
--- a/fs/xfs/xfs_trans_dquot.c
+++ b/fs/xfs/xfs_trans_dquot.c
@@ -103,8 +103,6 @@ xfs_trans_dup_dqinfo(
103 return; 103 return;
104 104
105 xfs_trans_alloc_dqinfo(ntp); 105 xfs_trans_alloc_dqinfo(ntp);
106 oqa = otp->t_dqinfo->dqa_usrdquots;
107 nqa = ntp->t_dqinfo->dqa_usrdquots;
108 106
109 /* 107 /*
110 * Because the quota blk reservation is carried forward, 108 * Because the quota blk reservation is carried forward,
@@ -113,7 +111,9 @@ xfs_trans_dup_dqinfo(
113 if(otp->t_flags & XFS_TRANS_DQ_DIRTY) 111 if(otp->t_flags & XFS_TRANS_DQ_DIRTY)
114 ntp->t_flags |= XFS_TRANS_DQ_DIRTY; 112 ntp->t_flags |= XFS_TRANS_DQ_DIRTY;
115 113
116 for (j = 0; j < 2; j++) { 114 for (j = 0; j < XFS_QM_TRANS_DQTYPES; j++) {
115 oqa = otp->t_dqinfo->dqs[j];
116 nqa = ntp->t_dqinfo->dqs[j];
117 for (i = 0; i < XFS_QM_TRANS_MAXDQS; i++) { 117 for (i = 0; i < XFS_QM_TRANS_MAXDQS; i++) {
118 if (oqa[i].qt_dquot == NULL) 118 if (oqa[i].qt_dquot == NULL)
119 break; 119 break;
@@ -138,8 +138,6 @@ xfs_trans_dup_dqinfo(
138 oq->qt_ino_res = oq->qt_ino_res_used; 138 oq->qt_ino_res = oq->qt_ino_res_used;
139 139
140 } 140 }
141 oqa = otp->t_dqinfo->dqa_grpdquots;
142 nqa = ntp->t_dqinfo->dqa_grpdquots;
143 } 141 }
144} 142}
145 143
@@ -177,8 +175,10 @@ xfs_trans_get_dqtrx(
177 int i; 175 int i;
178 struct xfs_dqtrx *qa; 176 struct xfs_dqtrx *qa;
179 177
180 qa = XFS_QM_ISUDQ(dqp) ? 178 if (XFS_QM_ISUDQ(dqp))
181 tp->t_dqinfo->dqa_usrdquots : tp->t_dqinfo->dqa_grpdquots; 179 qa = tp->t_dqinfo->dqs[XFS_QM_TRANS_USR];
180 else
181 qa = tp->t_dqinfo->dqs[XFS_QM_TRANS_GRP];
182 182
183 for (i = 0; i < XFS_QM_TRANS_MAXDQS; i++) { 183 for (i = 0; i < XFS_QM_TRANS_MAXDQS; i++) {
184 if (qa[i].qt_dquot == NULL || 184 if (qa[i].qt_dquot == NULL ||
@@ -338,12 +338,10 @@ xfs_trans_apply_dquot_deltas(
338 return; 338 return;
339 339
340 ASSERT(tp->t_dqinfo); 340 ASSERT(tp->t_dqinfo);
341 qa = tp->t_dqinfo->dqa_usrdquots; 341 for (j = 0; j < XFS_QM_TRANS_DQTYPES; j++) {
342 for (j = 0; j < 2; j++) { 342 qa = tp->t_dqinfo->dqs[j];
343 if (qa[0].qt_dquot == NULL) { 343 if (qa[0].qt_dquot == NULL)
344 qa = tp->t_dqinfo->dqa_grpdquots;
345 continue; 344 continue;
346 }
347 345
348 /* 346 /*
349 * Lock all of the dquots and join them to the transaction. 347 * Lock all of the dquots and join them to the transaction.
@@ -494,10 +492,6 @@ xfs_trans_apply_dquot_deltas(
494 ASSERT(dqp->q_res_rtbcount >= 492 ASSERT(dqp->q_res_rtbcount >=
495 be64_to_cpu(dqp->q_core.d_rtbcount)); 493 be64_to_cpu(dqp->q_core.d_rtbcount));
496 } 494 }
497 /*
498 * Do the group quotas next
499 */
500 qa = tp->t_dqinfo->dqa_grpdquots;
501 } 495 }
502} 496}
503 497
@@ -520,9 +514,9 @@ xfs_trans_unreserve_and_mod_dquots(
520 if (!tp->t_dqinfo || !(tp->t_flags & XFS_TRANS_DQ_DIRTY)) 514 if (!tp->t_dqinfo || !(tp->t_flags & XFS_TRANS_DQ_DIRTY))
521 return; 515 return;
522 516
523 qa = tp->t_dqinfo->dqa_usrdquots; 517 for (j = 0; j < XFS_QM_TRANS_DQTYPES; j++) {
518 qa = tp->t_dqinfo->dqs[j];
524 519
525 for (j = 0; j < 2; j++) {
526 for (i = 0; i < XFS_QM_TRANS_MAXDQS; i++) { 520 for (i = 0; i < XFS_QM_TRANS_MAXDQS; i++) {
527 qtrx = &qa[i]; 521 qtrx = &qa[i];
528 /* 522 /*
@@ -564,7 +558,6 @@ xfs_trans_unreserve_and_mod_dquots(
564 xfs_dqunlock(dqp); 558 xfs_dqunlock(dqp);
565 559
566 } 560 }
567 qa = tp->t_dqinfo->dqa_grpdquots;
568 } 561 }
569} 562}
570 563