aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_trans_dquot.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-07-13 14:40:24 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-13 14:40:24 -0400
commit239dab4636f7f5f971ac39b5ca84254cff112cac (patch)
treeba16a01035dd13bb87795911da436b6295f9b341 /fs/xfs/xfs_trans_dquot.c
parentf1c410885288e0042099960ee9e0c260dfea4cfb (diff)
parentc31ad439e8d111bf911c9cc80619cebde411a44d (diff)
Merge tag 'for-linus-v3.11-rc1-2' of git://oss.sgi.com/xfs/xfs
Pull more xfs updates from Ben Myers: "Here are a fix for xfs_fsr, a cleanup in bulkstat, a cleanup in xfs_open_by_handle, updated mount options documentation, a cleanup in xfs_bmapi_write, a fix for the size of dquot log reservations, a fix for sgid inheritance when acls are in use, a fix for cleaning up quotainfo structures, and some more of the work which allows group and project quotas to be used together. We had a few more in this last quota category that we might have liked to get in, but it looks there are still a few items that need to be addressed. - fix for xfs_fsr returning -EINVAL - cleanup in xfs_bulkstat - cleanup in xfs_open_by_handle - update mount options documentation - clean up local format handling in xfs_bmapi_write - fix dquot log reservations which were too small - fix sgid inheritance for subdirectories when default acls are in use - add project quota fields to various structures - fix teardown of quotainfo structures when quotas are turned off" * tag 'for-linus-v3.11-rc1-2' of git://oss.sgi.com/xfs/xfs: xfs: Fix the logic check for all quotas being turned off xfs: Add pquota fields where gquota is used. xfs: fix sgid inheritance for subdirectories inheriting default acls [V3] xfs: dquot log reservations are too small xfs: remove local fork format handling from xfs_bmapi_write() xfs: update mount options documentation xfs: use get_unused_fd_flags(0) instead of get_unused_fd() xfs: clean up unused codes at xfs_bulkstat() xfs: use XFS_BMAP_BMDR_SPACE vs. XFS_BROOT_SIZE_ADJ
Diffstat (limited to 'fs/xfs/xfs_trans_dquot.c')
-rw-r--r--fs/xfs/xfs_trans_dquot.c35
1 files changed, 26 insertions, 9 deletions
diff --git a/fs/xfs/xfs_trans_dquot.c b/fs/xfs/xfs_trans_dquot.c
index 3ba64d540168..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 ||
@@ -291,11 +297,10 @@ xfs_trans_mod_dquot(
291 297
292 298
293/* 299/*
294 * Given an array of dqtrx structures, lock all the dquots associated 300 * Given an array of dqtrx structures, lock all the dquots associated and join
295 * and join them to the transaction, provided they have been modified. 301 * them to the transaction, provided they have been modified. We know that the
296 * We know that the highest number of dquots (of one type - usr OR grp), 302 * highest number of dquots of one type - usr, grp OR prj - involved in a
297 * involved in a transaction is 2 and that both usr and grp combined - 3. 303 * transaction is 2 so we don't need to make this very generic.
298 * So, we don't attempt to make this very generic.
299 */ 304 */
300STATIC void 305STATIC void
301xfs_trans_dqlockedjoin( 306xfs_trans_dqlockedjoin(
@@ -728,8 +733,8 @@ error_return:
728 733
729/* 734/*
730 * 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.
731 * The fact that this does the reservation against both the usr and 736 * The fact that this does the reservation against user, group and
732 * grp/prj quotas is important, because this follows a both-or-nothing 737 * project quotas is important, because this follows a all-or-nothing
733 * approach. 738 * approach.
734 * 739 *
735 * flags = XFS_QMOPT_FORCE_RES evades limit enforcement. Used by chown. 740 * flags = XFS_QMOPT_FORCE_RES evades limit enforcement. Used by chown.
@@ -744,6 +749,7 @@ xfs_trans_reserve_quota_bydquots(
744 struct xfs_mount *mp, 749 struct xfs_mount *mp,
745 struct xfs_dquot *udqp, 750 struct xfs_dquot *udqp,
746 struct xfs_dquot *gdqp, 751 struct xfs_dquot *gdqp,
752 struct xfs_dquot *pdqp,
747 long nblks, 753 long nblks,
748 long ninos, 754 long ninos,
749 uint flags) 755 uint flags)
@@ -771,11 +777,21 @@ xfs_trans_reserve_quota_bydquots(
771 goto unwind_usr; 777 goto unwind_usr;
772 } 778 }
773 779
780 if (pdqp) {
781 error = xfs_trans_dqresv(tp, mp, pdqp, nblks, ninos, flags);
782 if (error)
783 goto unwind_grp;
784 }
785
774 /* 786 /*
775 * Didn't change anything critical, so, no need to log 787 * Didn't change anything critical, so, no need to log
776 */ 788 */
777 return 0; 789 return 0;
778 790
791unwind_grp:
792 flags |= XFS_QMOPT_FORCE_RES;
793 if (gdqp)
794 xfs_trans_dqresv(tp, mp, gdqp, -nblks, -ninos, flags);
779unwind_usr: 795unwind_usr:
780 flags |= XFS_QMOPT_FORCE_RES; 796 flags |= XFS_QMOPT_FORCE_RES;
781 if (udqp) 797 if (udqp)
@@ -817,6 +833,7 @@ xfs_trans_reserve_quota_nblks(
817 */ 833 */
818 return xfs_trans_reserve_quota_bydquots(tp, mp, 834 return xfs_trans_reserve_quota_bydquots(tp, mp,
819 ip->i_udquot, ip->i_gdquot, 835 ip->i_udquot, ip->i_gdquot,
836 ip->i_pdquot,
820 nblks, ninos, flags); 837 nblks, ninos, flags);
821} 838}
822 839