aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/quota/xfs_qm.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/quota/xfs_qm.c')
-rw-r--r--fs/xfs/quota/xfs_qm.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/quota/xfs_qm.c
index 3ea75972767c..3254cb7b87f4 100644
--- a/fs/xfs/quota/xfs_qm.c
+++ b/fs/xfs/quota/xfs_qm.c
@@ -1251,6 +1251,10 @@ xfs_qm_init_quotainfo(
1251 INT_GET(ddqp->d_iwarns, ARCH_CONVERT) ? 1251 INT_GET(ddqp->d_iwarns, ARCH_CONVERT) ?
1252 INT_GET(ddqp->d_iwarns, ARCH_CONVERT) : 1252 INT_GET(ddqp->d_iwarns, ARCH_CONVERT) :
1253 XFS_QM_IWARNLIMIT; 1253 XFS_QM_IWARNLIMIT;
1254 qinf->qi_rtbwarnlimit =
1255 INT_GET(ddqp->d_rtbwarns, ARCH_CONVERT) ?
1256 INT_GET(ddqp->d_rtbwarns, ARCH_CONVERT) :
1257 XFS_QM_RTBWARNLIMIT;
1254 qinf->qi_bhardlimit = 1258 qinf->qi_bhardlimit =
1255 INT_GET(ddqp->d_blk_hardlimit, ARCH_CONVERT); 1259 INT_GET(ddqp->d_blk_hardlimit, ARCH_CONVERT);
1256 qinf->qi_bsoftlimit = 1260 qinf->qi_bsoftlimit =
@@ -1276,6 +1280,7 @@ xfs_qm_init_quotainfo(
1276 qinf->qi_rtbtimelimit = XFS_QM_RTBTIMELIMIT; 1280 qinf->qi_rtbtimelimit = XFS_QM_RTBTIMELIMIT;
1277 qinf->qi_bwarnlimit = XFS_QM_BWARNLIMIT; 1281 qinf->qi_bwarnlimit = XFS_QM_BWARNLIMIT;
1278 qinf->qi_iwarnlimit = XFS_QM_IWARNLIMIT; 1282 qinf->qi_iwarnlimit = XFS_QM_IWARNLIMIT;
1283 qinf->qi_rtbwarnlimit = XFS_QM_RTBWARNLIMIT;
1279 } 1284 }
1280 1285
1281 return (0); 1286 return (0);
@@ -2624,6 +2629,9 @@ xfs_qm_vop_chown(
2624 xfs_dquot_t *newdq) 2629 xfs_dquot_t *newdq)
2625{ 2630{
2626 xfs_dquot_t *prevdq; 2631 xfs_dquot_t *prevdq;
2632 uint bfield = XFS_IS_REALTIME_INODE(ip) ?
2633 XFS_TRANS_DQ_RTBCOUNT : XFS_TRANS_DQ_BCOUNT;
2634
2627 ASSERT(XFS_ISLOCKED_INODE_EXCL(ip)); 2635 ASSERT(XFS_ISLOCKED_INODE_EXCL(ip));
2628 ASSERT(XFS_IS_QUOTA_RUNNING(ip->i_mount)); 2636 ASSERT(XFS_IS_QUOTA_RUNNING(ip->i_mount));
2629 2637
@@ -2632,20 +2640,12 @@ xfs_qm_vop_chown(
2632 ASSERT(prevdq); 2640 ASSERT(prevdq);
2633 ASSERT(prevdq != newdq); 2641 ASSERT(prevdq != newdq);
2634 2642
2635 xfs_trans_mod_dquot(tp, prevdq, 2643 xfs_trans_mod_dquot(tp, prevdq, bfield, -(ip->i_d.di_nblocks));
2636 XFS_TRANS_DQ_BCOUNT, 2644 xfs_trans_mod_dquot(tp, prevdq, XFS_TRANS_DQ_ICOUNT, -1);
2637 -(ip->i_d.di_nblocks));
2638 xfs_trans_mod_dquot(tp, prevdq,
2639 XFS_TRANS_DQ_ICOUNT,
2640 -1);
2641 2645
2642 /* the sparkling new dquot */ 2646 /* the sparkling new dquot */
2643 xfs_trans_mod_dquot(tp, newdq, 2647 xfs_trans_mod_dquot(tp, newdq, bfield, ip->i_d.di_nblocks);
2644 XFS_TRANS_DQ_BCOUNT, 2648 xfs_trans_mod_dquot(tp, newdq, XFS_TRANS_DQ_ICOUNT, 1);
2645 ip->i_d.di_nblocks);
2646 xfs_trans_mod_dquot(tp, newdq,
2647 XFS_TRANS_DQ_ICOUNT,
2648 1);
2649 2649
2650 /* 2650 /*
2651 * Take an extra reference, because the inode 2651 * Take an extra reference, because the inode
@@ -2673,7 +2673,7 @@ xfs_qm_vop_chown_reserve(
2673{ 2673{
2674 int error; 2674 int error;
2675 xfs_mount_t *mp; 2675 xfs_mount_t *mp;
2676 uint delblks; 2676 uint delblks, blkflags;
2677 xfs_dquot_t *unresudq, *unresgdq, *delblksudq, *delblksgdq; 2677 xfs_dquot_t *unresudq, *unresgdq, *delblksudq, *delblksgdq;
2678 2678
2679 ASSERT(XFS_ISLOCKED_INODE(ip)); 2679 ASSERT(XFS_ISLOCKED_INODE(ip));
@@ -2682,6 +2682,8 @@ xfs_qm_vop_chown_reserve(
2682 2682
2683 delblks = ip->i_delayed_blks; 2683 delblks = ip->i_delayed_blks;
2684 delblksudq = delblksgdq = unresudq = unresgdq = NULL; 2684 delblksudq = delblksgdq = unresudq = unresgdq = NULL;
2685 blkflags = XFS_IS_REALTIME_INODE(ip) ?
2686 XFS_QMOPT_RES_RTBLKS : XFS_QMOPT_RES_REGBLKS;
2685 2687
2686 if (XFS_IS_UQUOTA_ON(mp) && udqp && 2688 if (XFS_IS_UQUOTA_ON(mp) && udqp &&
2687 ip->i_d.di_uid != (uid_t)INT_GET(udqp->q_core.d_id, ARCH_CONVERT)) { 2689 ip->i_d.di_uid != (uid_t)INT_GET(udqp->q_core.d_id, ARCH_CONVERT)) {
@@ -2711,7 +2713,7 @@ xfs_qm_vop_chown_reserve(
2711 2713
2712 if ((error = xfs_trans_reserve_quota_bydquots(tp, ip->i_mount, 2714 if ((error = xfs_trans_reserve_quota_bydquots(tp, ip->i_mount,
2713 delblksudq, delblksgdq, ip->i_d.di_nblocks, 1, 2715 delblksudq, delblksgdq, ip->i_d.di_nblocks, 1,
2714 flags | XFS_QMOPT_RES_REGBLKS))) 2716 flags | blkflags)))
2715 return (error); 2717 return (error);
2716 2718
2717 /* 2719 /*
@@ -2728,11 +2730,11 @@ xfs_qm_vop_chown_reserve(
2728 ASSERT(unresudq || unresgdq); 2730 ASSERT(unresudq || unresgdq);
2729 if ((error = xfs_trans_reserve_quota_bydquots(NULL, ip->i_mount, 2731 if ((error = xfs_trans_reserve_quota_bydquots(NULL, ip->i_mount,
2730 delblksudq, delblksgdq, (xfs_qcnt_t)delblks, 0, 2732 delblksudq, delblksgdq, (xfs_qcnt_t)delblks, 0,
2731 flags | XFS_QMOPT_RES_REGBLKS))) 2733 flags | blkflags)))
2732 return (error); 2734 return (error);
2733 xfs_trans_reserve_quota_bydquots(NULL, ip->i_mount, 2735 xfs_trans_reserve_quota_bydquots(NULL, ip->i_mount,
2734 unresudq, unresgdq, -((xfs_qcnt_t)delblks), 0, 2736 unresudq, unresgdq, -((xfs_qcnt_t)delblks), 0,
2735 XFS_QMOPT_RES_REGBLKS); 2737 blkflags);
2736 } 2738 }
2737 2739
2738 return (0); 2740 return (0);