diff options
Diffstat (limited to 'fs/xfs/quota/xfs_trans_dquot.c')
-rw-r--r-- | fs/xfs/quota/xfs_trans_dquot.c | 65 |
1 files changed, 25 insertions, 40 deletions
diff --git a/fs/xfs/quota/xfs_trans_dquot.c b/fs/xfs/quota/xfs_trans_dquot.c index 447173bcf96d..eafa7ab34085 100644 --- a/fs/xfs/quota/xfs_trans_dquot.c +++ b/fs/xfs/quota/xfs_trans_dquot.c | |||
@@ -111,7 +111,7 @@ xfs_trans_log_dquot( | |||
111 | * Carry forward whatever is left of the quota blk reservation to | 111 | * Carry forward whatever is left of the quota blk reservation to |
112 | * the spanky new transaction | 112 | * the spanky new transaction |
113 | */ | 113 | */ |
114 | STATIC void | 114 | void |
115 | xfs_trans_dup_dqinfo( | 115 | xfs_trans_dup_dqinfo( |
116 | xfs_trans_t *otp, | 116 | xfs_trans_t *otp, |
117 | xfs_trans_t *ntp) | 117 | xfs_trans_t *ntp) |
@@ -167,19 +167,17 @@ xfs_trans_dup_dqinfo( | |||
167 | /* | 167 | /* |
168 | * Wrap around mod_dquot to account for both user and group quotas. | 168 | * Wrap around mod_dquot to account for both user and group quotas. |
169 | */ | 169 | */ |
170 | STATIC void | 170 | void |
171 | xfs_trans_mod_dquot_byino( | 171 | xfs_trans_mod_dquot_byino( |
172 | xfs_trans_t *tp, | 172 | xfs_trans_t *tp, |
173 | xfs_inode_t *ip, | 173 | xfs_inode_t *ip, |
174 | uint field, | 174 | uint field, |
175 | long delta) | 175 | long delta) |
176 | { | 176 | { |
177 | xfs_mount_t *mp; | 177 | xfs_mount_t *mp = tp->t_mountp; |
178 | |||
179 | ASSERT(tp); | ||
180 | mp = tp->t_mountp; | ||
181 | 178 | ||
182 | if (!XFS_IS_QUOTA_ON(mp) || | 179 | if (!XFS_IS_QUOTA_RUNNING(mp) || |
180 | !XFS_IS_QUOTA_ON(mp) || | ||
183 | ip->i_ino == mp->m_sb.sb_uquotino || | 181 | ip->i_ino == mp->m_sb.sb_uquotino || |
184 | ip->i_ino == mp->m_sb.sb_gquotino) | 182 | ip->i_ino == mp->m_sb.sb_gquotino) |
185 | return; | 183 | return; |
@@ -229,6 +227,7 @@ xfs_trans_mod_dquot( | |||
229 | xfs_dqtrx_t *qtrx; | 227 | xfs_dqtrx_t *qtrx; |
230 | 228 | ||
231 | ASSERT(tp); | 229 | ASSERT(tp); |
230 | ASSERT(XFS_IS_QUOTA_RUNNING(tp->t_mountp)); | ||
232 | qtrx = NULL; | 231 | qtrx = NULL; |
233 | 232 | ||
234 | if (tp->t_dqinfo == NULL) | 233 | if (tp->t_dqinfo == NULL) |
@@ -346,7 +345,7 @@ xfs_trans_dqlockedjoin( | |||
346 | * Unreserve just the reservations done by this transaction. | 345 | * Unreserve just the reservations done by this transaction. |
347 | * dquot is still left locked at exit. | 346 | * dquot is still left locked at exit. |
348 | */ | 347 | */ |
349 | STATIC void | 348 | void |
350 | xfs_trans_apply_dquot_deltas( | 349 | xfs_trans_apply_dquot_deltas( |
351 | xfs_trans_t *tp) | 350 | xfs_trans_t *tp) |
352 | { | 351 | { |
@@ -357,7 +356,7 @@ xfs_trans_apply_dquot_deltas( | |||
357 | long totalbdelta; | 356 | long totalbdelta; |
358 | long totalrtbdelta; | 357 | long totalrtbdelta; |
359 | 358 | ||
360 | if (! (tp->t_flags & XFS_TRANS_DQ_DIRTY)) | 359 | if (!(tp->t_flags & XFS_TRANS_DQ_DIRTY)) |
361 | return; | 360 | return; |
362 | 361 | ||
363 | ASSERT(tp->t_dqinfo); | 362 | ASSERT(tp->t_dqinfo); |
@@ -531,7 +530,7 @@ xfs_trans_apply_dquot_deltas( | |||
531 | * we simply throw those away, since that's the expected behavior | 530 | * we simply throw those away, since that's the expected behavior |
532 | * when a transaction is curtailed without a commit. | 531 | * when a transaction is curtailed without a commit. |
533 | */ | 532 | */ |
534 | STATIC void | 533 | void |
535 | xfs_trans_unreserve_and_mod_dquots( | 534 | xfs_trans_unreserve_and_mod_dquots( |
536 | xfs_trans_t *tp) | 535 | xfs_trans_t *tp) |
537 | { | 536 | { |
@@ -768,7 +767,7 @@ xfs_trans_reserve_quota_bydquots( | |||
768 | { | 767 | { |
769 | int resvd = 0, error; | 768 | int resvd = 0, error; |
770 | 769 | ||
771 | if (!XFS_IS_QUOTA_ON(mp)) | 770 | if (!XFS_IS_QUOTA_RUNNING(mp) || !XFS_IS_QUOTA_ON(mp)) |
772 | return 0; | 771 | return 0; |
773 | 772 | ||
774 | if (tp && tp->t_dqinfo == NULL) | 773 | if (tp && tp->t_dqinfo == NULL) |
@@ -811,18 +810,17 @@ xfs_trans_reserve_quota_bydquots( | |||
811 | * This doesn't change the actual usage, just the reservation. | 810 | * This doesn't change the actual usage, just the reservation. |
812 | * The inode sent in is locked. | 811 | * The inode sent in is locked. |
813 | */ | 812 | */ |
814 | STATIC int | 813 | int |
815 | xfs_trans_reserve_quota_nblks( | 814 | xfs_trans_reserve_quota_nblks( |
816 | xfs_trans_t *tp, | 815 | struct xfs_trans *tp, |
817 | xfs_mount_t *mp, | 816 | struct xfs_inode *ip, |
818 | xfs_inode_t *ip, | 817 | long nblks, |
819 | long nblks, | 818 | long ninos, |
820 | long ninos, | 819 | uint flags) |
821 | uint flags) | ||
822 | { | 820 | { |
823 | int error; | 821 | struct xfs_mount *mp = ip->i_mount; |
824 | 822 | ||
825 | if (!XFS_IS_QUOTA_ON(mp)) | 823 | if (!XFS_IS_QUOTA_RUNNING(mp) || !XFS_IS_QUOTA_ON(mp)) |
826 | return 0; | 824 | return 0; |
827 | if (XFS_IS_PQUOTA_ON(mp)) | 825 | if (XFS_IS_PQUOTA_ON(mp)) |
828 | flags |= XFS_QMOPT_ENOSPC; | 826 | flags |= XFS_QMOPT_ENOSPC; |
@@ -831,7 +829,6 @@ xfs_trans_reserve_quota_nblks( | |||
831 | ASSERT(ip->i_ino != mp->m_sb.sb_gquotino); | 829 | ASSERT(ip->i_ino != mp->m_sb.sb_gquotino); |
832 | 830 | ||
833 | ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); | 831 | ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); |
834 | ASSERT(XFS_IS_QUOTA_RUNNING(ip->i_mount)); | ||
835 | ASSERT((flags & ~(XFS_QMOPT_FORCE_RES | XFS_QMOPT_ENOSPC)) == | 832 | ASSERT((flags & ~(XFS_QMOPT_FORCE_RES | XFS_QMOPT_ENOSPC)) == |
836 | XFS_TRANS_DQ_RES_RTBLKS || | 833 | XFS_TRANS_DQ_RES_RTBLKS || |
837 | (flags & ~(XFS_QMOPT_FORCE_RES | XFS_QMOPT_ENOSPC)) == | 834 | (flags & ~(XFS_QMOPT_FORCE_RES | XFS_QMOPT_ENOSPC)) == |
@@ -840,11 +837,9 @@ xfs_trans_reserve_quota_nblks( | |||
840 | /* | 837 | /* |
841 | * Reserve nblks against these dquots, with trans as the mediator. | 838 | * Reserve nblks against these dquots, with trans as the mediator. |
842 | */ | 839 | */ |
843 | error = xfs_trans_reserve_quota_bydquots(tp, mp, | 840 | return xfs_trans_reserve_quota_bydquots(tp, mp, |
844 | ip->i_udquot, ip->i_gdquot, | 841 | ip->i_udquot, ip->i_gdquot, |
845 | nblks, ninos, | 842 | nblks, ninos, flags); |
846 | flags); | ||
847 | return error; | ||
848 | } | 843 | } |
849 | 844 | ||
850 | /* | 845 | /* |
@@ -895,25 +890,15 @@ STATIC void | |||
895 | xfs_trans_alloc_dqinfo( | 890 | xfs_trans_alloc_dqinfo( |
896 | xfs_trans_t *tp) | 891 | xfs_trans_t *tp) |
897 | { | 892 | { |
898 | (tp)->t_dqinfo = kmem_zone_zalloc(xfs_Gqm->qm_dqtrxzone, KM_SLEEP); | 893 | tp->t_dqinfo = kmem_zone_zalloc(xfs_Gqm->qm_dqtrxzone, KM_SLEEP); |
899 | } | 894 | } |
900 | 895 | ||
901 | STATIC void | 896 | void |
902 | xfs_trans_free_dqinfo( | 897 | xfs_trans_free_dqinfo( |
903 | xfs_trans_t *tp) | 898 | xfs_trans_t *tp) |
904 | { | 899 | { |
905 | if (!tp->t_dqinfo) | 900 | if (!tp->t_dqinfo) |
906 | return; | 901 | return; |
907 | kmem_zone_free(xfs_Gqm->qm_dqtrxzone, (tp)->t_dqinfo); | 902 | kmem_zone_free(xfs_Gqm->qm_dqtrxzone, tp->t_dqinfo); |
908 | (tp)->t_dqinfo = NULL; | 903 | tp->t_dqinfo = NULL; |
909 | } | 904 | } |
910 | |||
911 | xfs_dqtrxops_t xfs_trans_dquot_ops = { | ||
912 | .qo_dup_dqinfo = xfs_trans_dup_dqinfo, | ||
913 | .qo_free_dqinfo = xfs_trans_free_dqinfo, | ||
914 | .qo_mod_dquot_byino = xfs_trans_mod_dquot_byino, | ||
915 | .qo_apply_dquot_deltas = xfs_trans_apply_dquot_deltas, | ||
916 | .qo_reserve_quota_nblks = xfs_trans_reserve_quota_nblks, | ||
917 | .qo_reserve_quota_bydquots = xfs_trans_reserve_quota_bydquots, | ||
918 | .qo_unreserve_and_mod_dquots = xfs_trans_unreserve_and_mod_dquots, | ||
919 | }; | ||