aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_trans_dquot.c
diff options
context:
space:
mode:
authorChandra Seetharaman <sekharan@us.ibm.com>2013-07-11 01:00:40 -0400
committerBen Myers <bpm@sgi.com>2013-07-11 11:35:32 -0400
commit92f8ff73f18672b03ec8b92197cdddf2b5de7ea0 (patch)
treeb90205ed9a1e141d8ac5d096f4d8984e89774d2e /fs/xfs/xfs_trans_dquot.c
parent42c49d7f249c2487f36d3314753d5d8ebcee8249 (diff)
xfs: Add pquota fields where gquota is used.
Add project quota changes to all the places where group quota field is used: * add separate project quota members into various structures * split project quota and group quotas so that instead of overriding the group quota members incore, the new project quota members are used instead * get rid of usage of the OQUOTA flag incore, in favor of separate group and project quota flags. * add a project dquot argument to various functions. Not using the pquotino field from superblock yet. 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/xfs_trans_dquot.c')
-rw-r--r--fs/xfs/xfs_trans_dquot.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/fs/xfs/xfs_trans_dquot.c b/fs/xfs/xfs_trans_dquot.c
index db041a5e1f6d..61407a847b86 100644
--- a/fs/xfs/xfs_trans_dquot.c
+++ b/fs/xfs/xfs_trans_dquot.c
@@ -163,8 +163,10 @@ xfs_trans_mod_dquot_byino(
163 163
164 if (XFS_IS_UQUOTA_ON(mp) && ip->i_udquot) 164 if (XFS_IS_UQUOTA_ON(mp) && ip->i_udquot)
165 (void) xfs_trans_mod_dquot(tp, ip->i_udquot, field, delta); 165 (void) xfs_trans_mod_dquot(tp, ip->i_udquot, field, delta);
166 if (XFS_IS_OQUOTA_ON(mp) && ip->i_gdquot) 166 if (XFS_IS_GQUOTA_ON(mp) && ip->i_gdquot)
167 (void) xfs_trans_mod_dquot(tp, ip->i_gdquot, field, delta); 167 (void) xfs_trans_mod_dquot(tp, ip->i_gdquot, field, delta);
168 if (XFS_IS_PQUOTA_ON(mp) && ip->i_pdquot)
169 (void) xfs_trans_mod_dquot(tp, ip->i_pdquot, field, delta);
168} 170}
169 171
170STATIC struct xfs_dqtrx * 172STATIC struct xfs_dqtrx *
@@ -177,8 +179,12 @@ xfs_trans_get_dqtrx(
177 179
178 if (XFS_QM_ISUDQ(dqp)) 180 if (XFS_QM_ISUDQ(dqp))
179 qa = tp->t_dqinfo->dqs[XFS_QM_TRANS_USR]; 181 qa = tp->t_dqinfo->dqs[XFS_QM_TRANS_USR];
180 else 182 else if (XFS_QM_ISGDQ(dqp))
181 qa = tp->t_dqinfo->dqs[XFS_QM_TRANS_GRP]; 183 qa = tp->t_dqinfo->dqs[XFS_QM_TRANS_GRP];
184 else if (XFS_QM_ISPDQ(dqp))
185 qa = tp->t_dqinfo->dqs[XFS_QM_TRANS_PRJ];
186 else
187 return NULL;
182 188
183 for (i = 0; i < XFS_QM_TRANS_MAXDQS; i++) { 189 for (i = 0; i < XFS_QM_TRANS_MAXDQS; i++) {
184 if (qa[i].qt_dquot == NULL || 190 if (qa[i].qt_dquot == NULL ||
@@ -727,8 +733,8 @@ error_return:
727 733
728/* 734/*
729 * Given dquot(s), make disk block and/or inode reservations against them. 735 * Given dquot(s), make disk block and/or inode reservations against them.
730 * The fact that this does the reservation against both the usr and 736 * The fact that this does the reservation against user, group and
731 * grp/prj quotas is important, because this follows a both-or-nothing 737 * project quotas is important, because this follows a all-or-nothing
732 * approach. 738 * approach.
733 * 739 *
734 * flags = XFS_QMOPT_FORCE_RES evades limit enforcement. Used by chown. 740 * flags = XFS_QMOPT_FORCE_RES evades limit enforcement. Used by chown.
@@ -743,6 +749,7 @@ xfs_trans_reserve_quota_bydquots(
743 struct xfs_mount *mp, 749 struct xfs_mount *mp,
744 struct xfs_dquot *udqp, 750 struct xfs_dquot *udqp,
745 struct xfs_dquot *gdqp, 751 struct xfs_dquot *gdqp,
752 struct xfs_dquot *pdqp,
746 long nblks, 753 long nblks,
747 long ninos, 754 long ninos,
748 uint flags) 755 uint flags)
@@ -770,11 +777,21 @@ xfs_trans_reserve_quota_bydquots(
770 goto unwind_usr; 777 goto unwind_usr;
771 } 778 }
772 779
780 if (pdqp) {
781 error = xfs_trans_dqresv(tp, mp, pdqp, nblks, ninos, flags);
782 if (error)
783 goto unwind_grp;
784 }
785
773 /* 786 /*
774 * Didn't change anything critical, so, no need to log 787 * Didn't change anything critical, so, no need to log
775 */ 788 */
776 return 0; 789 return 0;
777 790
791unwind_grp:
792 flags |= XFS_QMOPT_FORCE_RES;
793 if (gdqp)
794 xfs_trans_dqresv(tp, mp, gdqp, -nblks, -ninos, flags);
778unwind_usr: 795unwind_usr:
779 flags |= XFS_QMOPT_FORCE_RES; 796 flags |= XFS_QMOPT_FORCE_RES;
780 if (udqp) 797 if (udqp)
@@ -816,6 +833,7 @@ xfs_trans_reserve_quota_nblks(
816 */ 833 */
817 return xfs_trans_reserve_quota_bydquots(tp, mp, 834 return xfs_trans_reserve_quota_bydquots(tp, mp,
818 ip->i_udquot, ip->i_gdquot, 835 ip->i_udquot, ip->i_gdquot,
836 ip->i_pdquot,
819 nblks, ninos, flags); 837 nblks, ninos, flags);
820} 838}
821 839