Lines Matching +full:user +full:- +full:otp
1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2000-2002 Silicon Graphics, Inc.
34 ASSERT(dqp->q_logitem.qli_dquot == dqp); in xfs_trans_dqjoin()
39 xfs_trans_add_item(tp, &dqp->q_logitem.qli_item); in xfs_trans_dqjoin()
60 if (dqp->q_id != 0 && in xfs_trans_log_dquot()
61 xfs_has_bigtime(tp->t_mountp) && in xfs_trans_log_dquot()
62 !(dqp->q_type & XFS_DQTYPE_BIGTIME)) in xfs_trans_log_dquot()
63 dqp->q_type |= XFS_DQTYPE_BIGTIME; in xfs_trans_log_dquot()
65 tp->t_flags |= XFS_TRANS_DIRTY; in xfs_trans_log_dquot()
66 set_bit(XFS_LI_DIRTY, &dqp->q_logitem.qli_item.li_flags); in xfs_trans_log_dquot()
75 struct xfs_trans *otp, in xfs_trans_dup_dqinfo() argument
83 if (!otp->t_dqinfo) in xfs_trans_dup_dqinfo()
89 oqa = otp->t_dqinfo->dqs[j]; in xfs_trans_dup_dqinfo()
90 nqa = ntp->t_dqinfo->dqs[j]; in xfs_trans_dup_dqinfo()
99 if (oq->qt_blk_res && oq->qt_bcount_delta > 0) in xfs_trans_dup_dqinfo()
100 blk_res_used = oq->qt_bcount_delta; in xfs_trans_dup_dqinfo()
102 nq->qt_dquot = oq->qt_dquot; in xfs_trans_dup_dqinfo()
103 nq->qt_bcount_delta = nq->qt_icount_delta = 0; in xfs_trans_dup_dqinfo()
104 nq->qt_rtbcount_delta = 0; in xfs_trans_dup_dqinfo()
109 nq->qt_blk_res = oq->qt_blk_res - blk_res_used; in xfs_trans_dup_dqinfo()
110 oq->qt_blk_res = blk_res_used; in xfs_trans_dup_dqinfo()
112 nq->qt_rtblk_res = oq->qt_rtblk_res - in xfs_trans_dup_dqinfo()
113 oq->qt_rtblk_res_used; in xfs_trans_dup_dqinfo()
114 oq->qt_rtblk_res = oq->qt_rtblk_res_used; in xfs_trans_dup_dqinfo()
116 nq->qt_ino_res = oq->qt_ino_res - oq->qt_ino_res_used; in xfs_trans_dup_dqinfo()
117 oq->qt_ino_res = oq->qt_ino_res_used; in xfs_trans_dup_dqinfo()
124 * Wrap around mod_dquot to account for both user and group quotas.
133 xfs_mount_t *mp = tp->t_mountp; in xfs_trans_mod_dquot_byino()
136 xfs_is_quota_inode(&mp->m_sb, ip->i_ino)) in xfs_trans_mod_dquot_byino()
139 if (XFS_IS_UQUOTA_ON(mp) && ip->i_udquot) in xfs_trans_mod_dquot_byino()
140 (void) xfs_trans_mod_dquot(tp, ip->i_udquot, field, delta); in xfs_trans_mod_dquot_byino()
141 if (XFS_IS_GQUOTA_ON(mp) && ip->i_gdquot) in xfs_trans_mod_dquot_byino()
142 (void) xfs_trans_mod_dquot(tp, ip->i_gdquot, field, delta); in xfs_trans_mod_dquot_byino()
143 if (XFS_IS_PQUOTA_ON(mp) && ip->i_pdquot) in xfs_trans_mod_dquot_byino()
144 (void) xfs_trans_mod_dquot(tp, ip->i_pdquot, field, delta); in xfs_trans_mod_dquot_byino()
157 qa = tp->t_dqinfo->dqs[XFS_QM_TRANS_USR]; in xfs_trans_get_dqtrx()
160 qa = tp->t_dqinfo->dqs[XFS_QM_TRANS_GRP]; in xfs_trans_get_dqtrx()
163 qa = tp->t_dqinfo->dqs[XFS_QM_TRANS_PRJ]; in xfs_trans_get_dqtrx()
194 ASSERT(XFS_IS_QUOTA_ON(tp->t_mountp)); in xfs_trans_mod_dquot()
200 if (tp->t_dqinfo == NULL) in xfs_trans_mod_dquot()
208 if (qtrx->qt_dquot == NULL) in xfs_trans_mod_dquot()
209 qtrx->qt_dquot = dqp; in xfs_trans_mod_dquot()
217 qtrx->qt_blk_res += delta; in xfs_trans_mod_dquot()
222 qtrx->qt_ino_res += delta; in xfs_trans_mod_dquot()
227 qtrx->qt_bcount_delta += delta; in xfs_trans_mod_dquot()
231 qtrx->qt_delbcnt_delta += delta; in xfs_trans_mod_dquot()
236 if (qtrx->qt_ino_res && delta > 0) { in xfs_trans_mod_dquot()
237 qtrx->qt_ino_res_used += delta; in xfs_trans_mod_dquot()
238 ASSERT(qtrx->qt_ino_res >= qtrx->qt_ino_res_used); in xfs_trans_mod_dquot()
240 qtrx->qt_icount_delta += delta; in xfs_trans_mod_dquot()
245 qtrx->qt_rtblk_res += delta; in xfs_trans_mod_dquot()
250 if (qtrx->qt_rtblk_res && delta > 0) { in xfs_trans_mod_dquot()
251 qtrx->qt_rtblk_res_used += delta; in xfs_trans_mod_dquot()
252 ASSERT(qtrx->qt_rtblk_res >= qtrx->qt_rtblk_res_used); in xfs_trans_mod_dquot()
254 qtrx->qt_rtbcount_delta += delta; in xfs_trans_mod_dquot()
258 qtrx->qt_delrtb_delta += delta; in xfs_trans_mod_dquot()
272 * highest number of dquots of one type - usr, grp and prj - involved in a
312 res->reserved -= abs(reserved - res_used); in xfs_apply_quota_reservation_deltas()
320 res->reserved += count_delta; in xfs_apply_quota_reservation_deltas()
342 if (!tp->t_dqinfo) in xfs_trans_apply_dquot_deltas()
345 ASSERT(tp->t_dqinfo); in xfs_trans_apply_dquot_deltas()
347 qa = tp->t_dqinfo->dqs[j]; in xfs_trans_apply_dquot_deltas()
364 if ((dqp = qtrx->qt_dquot) == NULL) in xfs_trans_apply_dquot_deltas()
374 * The issue here is - sometimes we don't make a blkquota in xfs_trans_apply_dquot_deltas()
381 * non-delay blks. The assumption is that the in xfs_trans_apply_dquot_deltas()
386 totalbdelta = qtrx->qt_bcount_delta + in xfs_trans_apply_dquot_deltas()
387 qtrx->qt_delbcnt_delta; in xfs_trans_apply_dquot_deltas()
388 totalrtbdelta = qtrx->qt_rtbcount_delta + in xfs_trans_apply_dquot_deltas()
389 qtrx->qt_delrtb_delta; in xfs_trans_apply_dquot_deltas()
392 qtrx->qt_icount_delta != 0) { in xfs_trans_apply_dquot_deltas()
399 ASSERT(dqp->q_blk.count >= -totalbdelta); in xfs_trans_apply_dquot_deltas()
402 ASSERT(dqp->q_rtb.count >= -totalrtbdelta); in xfs_trans_apply_dquot_deltas()
404 if (qtrx->qt_icount_delta < 0) in xfs_trans_apply_dquot_deltas()
405 ASSERT(dqp->q_ino.count >= -qtrx->qt_icount_delta); in xfs_trans_apply_dquot_deltas()
408 dqp->q_blk.count += totalbdelta; in xfs_trans_apply_dquot_deltas()
410 if (qtrx->qt_icount_delta) in xfs_trans_apply_dquot_deltas()
411 dqp->q_ino.count += qtrx->qt_icount_delta; in xfs_trans_apply_dquot_deltas()
414 dqp->q_rtb.count += totalrtbdelta; in xfs_trans_apply_dquot_deltas()
417 qtrx->qt_icount_delta != 0) in xfs_trans_apply_dquot_deltas()
424 if (dqp->q_id) { in xfs_trans_apply_dquot_deltas()
429 dqp->q_flags |= XFS_DQFLAG_DIRTY; in xfs_trans_apply_dquot_deltas()
439 blk_res_used = max_t(int64_t, 0, qtrx->qt_bcount_delta); in xfs_trans_apply_dquot_deltas()
440 xfs_apply_quota_reservation_deltas(&dqp->q_blk, in xfs_trans_apply_dquot_deltas()
441 qtrx->qt_blk_res, blk_res_used, in xfs_trans_apply_dquot_deltas()
442 qtrx->qt_bcount_delta); in xfs_trans_apply_dquot_deltas()
447 xfs_apply_quota_reservation_deltas(&dqp->q_rtb, in xfs_trans_apply_dquot_deltas()
448 qtrx->qt_rtblk_res, in xfs_trans_apply_dquot_deltas()
449 qtrx->qt_rtblk_res_used, in xfs_trans_apply_dquot_deltas()
450 qtrx->qt_rtbcount_delta); in xfs_trans_apply_dquot_deltas()
455 ASSERT(qtrx->qt_ino_res >= qtrx->qt_ino_res_used); in xfs_trans_apply_dquot_deltas()
456 xfs_apply_quota_reservation_deltas(&dqp->q_ino, in xfs_trans_apply_dquot_deltas()
457 qtrx->qt_ino_res, in xfs_trans_apply_dquot_deltas()
458 qtrx->qt_ino_res_used, in xfs_trans_apply_dquot_deltas()
459 qtrx->qt_icount_delta); in xfs_trans_apply_dquot_deltas()
461 ASSERT(dqp->q_blk.reserved >= dqp->q_blk.count); in xfs_trans_apply_dquot_deltas()
462 ASSERT(dqp->q_ino.reserved >= dqp->q_ino.count); in xfs_trans_apply_dquot_deltas()
463 ASSERT(dqp->q_rtb.reserved >= dqp->q_rtb.count); in xfs_trans_apply_dquot_deltas()
484 if (!tp->t_dqinfo) in xfs_trans_unreserve_and_mod_dquots()
488 qa = tp->t_dqinfo->dqs[j]; in xfs_trans_unreserve_and_mod_dquots()
496 if ((dqp = qtrx->qt_dquot) == NULL) in xfs_trans_unreserve_and_mod_dquots()
504 if (qtrx->qt_blk_res) { in xfs_trans_unreserve_and_mod_dquots()
507 dqp->q_blk.reserved -= in xfs_trans_unreserve_and_mod_dquots()
508 (xfs_qcnt_t)qtrx->qt_blk_res; in xfs_trans_unreserve_and_mod_dquots()
510 if (qtrx->qt_ino_res) { in xfs_trans_unreserve_and_mod_dquots()
515 dqp->q_ino.reserved -= in xfs_trans_unreserve_and_mod_dquots()
516 (xfs_qcnt_t)qtrx->qt_ino_res; in xfs_trans_unreserve_and_mod_dquots()
519 if (qtrx->qt_rtblk_res) { in xfs_trans_unreserve_and_mod_dquots()
524 dqp->q_rtb.reserved -= in xfs_trans_unreserve_and_mod_dquots()
525 (xfs_qcnt_t)qtrx->qt_rtblk_res; in xfs_trans_unreserve_and_mod_dquots()
556 quota_send_warning(make_kqid(&init_user_ns, qtype, dqp->q_id), in xfs_quota_warn()
557 mp->m_super->s_dev, type); in xfs_quota_warn()
575 xfs_qcnt_t hardlimit = res->hardlimit; in xfs_dqresv_check()
576 xfs_qcnt_t softlimit = res->softlimit; in xfs_dqresv_check()
577 xfs_qcnt_t total_count = res->reserved + delta; in xfs_dqresv_check()
588 hardlimit = qlim->hard; in xfs_dqresv_check()
590 softlimit = qlim->soft; in xfs_dqresv_check()
600 if (res->timer != 0 && now > res->timer) { in xfs_dqresv_check()
626 struct xfs_quotainfo *q = mp->m_quotainfo; in xfs_trans_dqresv()
636 blkres = &dqp->q_blk; in xfs_trans_dqresv()
637 qlim = &defq->blk; in xfs_trans_dqresv()
639 blkres = &dqp->q_rtb; in xfs_trans_dqresv()
640 qlim = &defq->rtb; in xfs_trans_dqresv()
643 if ((flags & XFS_QMOPT_FORCE_RES) == 0 && dqp->q_id && in xfs_trans_dqresv()
663 quota_nl = xfs_dqresv_check(&dqp->q_ino, &defq->ino, ninos, in xfs_trans_dqresv()
676 blkres->reserved += (xfs_qcnt_t)nblks; in xfs_trans_dqresv()
677 dqp->q_ino.reserved += (xfs_qcnt_t)ninos; in xfs_trans_dqresv()
693 if (XFS_IS_CORRUPT(mp, dqp->q_blk.reserved < dqp->q_blk.count) || in xfs_trans_dqresv()
694 XFS_IS_CORRUPT(mp, dqp->q_rtb.reserved < dqp->q_rtb.count) || in xfs_trans_dqresv()
695 XFS_IS_CORRUPT(mp, dqp->q_ino.reserved < dqp->q_ino.count)) in xfs_trans_dqresv()
704 return -ENOSPC; in xfs_trans_dqresv()
705 return -EDQUOT; in xfs_trans_dqresv()
709 return -EFSCORRUPTED; in xfs_trans_dqresv()
715 * The fact that this does the reservation against user, group and
716 * project quotas is important, because this follows a all-or-nothing
769 xfs_trans_dqresv(tp, mp, gdqp, -nblks, -ninos, flags); in xfs_trans_reserve_quota_bydquots()
773 xfs_trans_dqresv(tp, mp, udqp, -nblks, -ninos, flags); in xfs_trans_reserve_quota_bydquots()
791 struct xfs_mount *mp = ip->i_mount; in xfs_trans_reserve_quota_nblks()
798 ASSERT(!xfs_is_quota_inode(&mp->m_sb, ip->i_ino)); in xfs_trans_reserve_quota_nblks()
805 error = xfs_trans_reserve_quota_bydquots(tp, mp, ip->i_udquot, in xfs_trans_reserve_quota_nblks()
806 ip->i_gdquot, ip->i_pdquot, dblocks, 0, in xfs_trans_reserve_quota_nblks()
812 error = xfs_trans_reserve_quota_bydquots(tp, mp, ip->i_udquot, in xfs_trans_reserve_quota_nblks()
813 ip->i_gdquot, ip->i_pdquot, rblocks, 0, in xfs_trans_reserve_quota_nblks()
816 xfs_trans_reserve_quota_bydquots(tp, mp, ip->i_udquot, in xfs_trans_reserve_quota_nblks()
817 ip->i_gdquot, ip->i_pdquot, -dblocks, 0, in xfs_trans_reserve_quota_nblks()
834 struct xfs_mount *mp = tp->t_mountp; in xfs_trans_reserve_quota_icreate()
847 tp->t_dqinfo = kmem_cache_zalloc(xfs_dqtrx_cache, in xfs_trans_alloc_dqinfo()
855 if (!tp->t_dqinfo) in xfs_trans_free_dqinfo()
857 kmem_cache_free(xfs_dqtrx_cache, tp->t_dqinfo); in xfs_trans_free_dqinfo()
858 tp->t_dqinfo = NULL; in xfs_trans_free_dqinfo()