Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0e6436d9 authored by Chandra Seetharaman's avatar Chandra Seetharaman Committed by Ben Myers
Browse files

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: default avatarChandra Seetharaman <sekharan@us.ibm.com>
Reviewed-by: default avatarBen Myers <bpm@sgi.com>
Signed-off-by: default avatarBen Myers <bpm@sgi.com>
parent 113a5683
Loading
Loading
Loading
Loading
+8 −4
Original line number Original line Diff line number Diff line
@@ -116,11 +116,15 @@ extern void xfs_trans_log_dquot(struct xfs_trans *, struct xfs_dquot *);
 * to do at commit time. All transactions that we know of at this point
 * to do at commit time. All transactions that we know of at this point
 * affect no more than two dquots of one type. Hence, the TRANS_MAXDQS value.
 * affect no more than two dquots of one type. Hence, the TRANS_MAXDQS value.
 */
 */
enum {
	XFS_QM_TRANS_USR = 0,
	XFS_QM_TRANS_GRP,
	XFS_QM_TRANS_DQTYPES
};
#define XFS_QM_TRANS_MAXDQS		2
#define XFS_QM_TRANS_MAXDQS		2
typedef struct xfs_dquot_acct {
struct xfs_dquot_acct {
	xfs_dqtrx_t	dqa_usrdquots[XFS_QM_TRANS_MAXDQS];
	struct xfs_dqtrx	dqs[XFS_QM_TRANS_DQTYPES][XFS_QM_TRANS_MAXDQS];
	xfs_dqtrx_t	dqa_grpdquots[XFS_QM_TRANS_MAXDQS];
};
} xfs_dquot_acct_t;


/*
/*
 * Users are allowed to have a usage exceeding their softlimit for
 * Users are allowed to have a usage exceeding their softlimit for
+12 −19
Original line number Original line Diff line number Diff line
@@ -103,8 +103,6 @@ xfs_trans_dup_dqinfo(
		return;
		return;


	xfs_trans_alloc_dqinfo(ntp);
	xfs_trans_alloc_dqinfo(ntp);
	oqa = otp->t_dqinfo->dqa_usrdquots;
	nqa = ntp->t_dqinfo->dqa_usrdquots;


	/*
	/*
	 * Because the quota blk reservation is carried forward,
	 * Because the quota blk reservation is carried forward,
@@ -113,7 +111,9 @@ xfs_trans_dup_dqinfo(
	if(otp->t_flags & XFS_TRANS_DQ_DIRTY)
	if(otp->t_flags & XFS_TRANS_DQ_DIRTY)
		ntp->t_flags |= XFS_TRANS_DQ_DIRTY;
		ntp->t_flags |= XFS_TRANS_DQ_DIRTY;


	for (j = 0; j < 2; j++) {
	for (j = 0; j < XFS_QM_TRANS_DQTYPES; j++) {
		oqa = otp->t_dqinfo->dqs[j];
		nqa = ntp->t_dqinfo->dqs[j];
		for (i = 0; i < XFS_QM_TRANS_MAXDQS; i++) {
		for (i = 0; i < XFS_QM_TRANS_MAXDQS; i++) {
			if (oqa[i].qt_dquot == NULL)
			if (oqa[i].qt_dquot == NULL)
				break;
				break;
@@ -138,8 +138,6 @@ xfs_trans_dup_dqinfo(
			oq->qt_ino_res = oq->qt_ino_res_used;
			oq->qt_ino_res = oq->qt_ino_res_used;


		}
		}
		oqa = otp->t_dqinfo->dqa_grpdquots;
		nqa = ntp->t_dqinfo->dqa_grpdquots;
	}
	}
}
}


@@ -177,8 +175,10 @@ xfs_trans_get_dqtrx(
	int			i;
	int			i;
	struct xfs_dqtrx	*qa;
	struct xfs_dqtrx	*qa;


	qa = XFS_QM_ISUDQ(dqp) ?
	if (XFS_QM_ISUDQ(dqp))
		tp->t_dqinfo->dqa_usrdquots : tp->t_dqinfo->dqa_grpdquots;
		qa = tp->t_dqinfo->dqs[XFS_QM_TRANS_USR];
	else
		qa = tp->t_dqinfo->dqs[XFS_QM_TRANS_GRP];


	for (i = 0; i < XFS_QM_TRANS_MAXDQS; i++) {
	for (i = 0; i < XFS_QM_TRANS_MAXDQS; i++) {
		if (qa[i].qt_dquot == NULL ||
		if (qa[i].qt_dquot == NULL ||
@@ -338,12 +338,10 @@ xfs_trans_apply_dquot_deltas(
		return;
		return;


	ASSERT(tp->t_dqinfo);
	ASSERT(tp->t_dqinfo);
	qa = tp->t_dqinfo->dqa_usrdquots;
	for (j = 0; j < XFS_QM_TRANS_DQTYPES; j++) {
	for (j = 0; j < 2; j++) {
		qa = tp->t_dqinfo->dqs[j];
		if (qa[0].qt_dquot == NULL) {
		if (qa[0].qt_dquot == NULL)
			qa = tp->t_dqinfo->dqa_grpdquots;
			continue;
			continue;
		}


		/*
		/*
		 * Lock all of the dquots and join them to the transaction.
		 * Lock all of the dquots and join them to the transaction.
@@ -494,10 +492,6 @@ xfs_trans_apply_dquot_deltas(
			ASSERT(dqp->q_res_rtbcount >=
			ASSERT(dqp->q_res_rtbcount >=
				be64_to_cpu(dqp->q_core.d_rtbcount));
				be64_to_cpu(dqp->q_core.d_rtbcount));
		}
		}
		/*
		 * Do the group quotas next
		 */
		qa = tp->t_dqinfo->dqa_grpdquots;
	}
	}
}
}


@@ -520,9 +514,9 @@ xfs_trans_unreserve_and_mod_dquots(
	if (!tp->t_dqinfo || !(tp->t_flags & XFS_TRANS_DQ_DIRTY))
	if (!tp->t_dqinfo || !(tp->t_flags & XFS_TRANS_DQ_DIRTY))
		return;
		return;


	qa = tp->t_dqinfo->dqa_usrdquots;
	for (j = 0; j < XFS_QM_TRANS_DQTYPES; j++) {
		qa = tp->t_dqinfo->dqs[j];


	for (j = 0; j < 2; j++) {
		for (i = 0; i < XFS_QM_TRANS_MAXDQS; i++) {
		for (i = 0; i < XFS_QM_TRANS_MAXDQS; i++) {
			qtrx = &qa[i];
			qtrx = &qa[i];
			/*
			/*
@@ -564,7 +558,6 @@ xfs_trans_unreserve_and_mod_dquots(
				xfs_dqunlock(dqp);
				xfs_dqunlock(dqp);


		}
		}
		qa = tp->t_dqinfo->dqa_grpdquots;
	}
	}
}
}