2 * Copyright (c) 2000-2002 Silicon Graphics, Inc.
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 #include "xfs_trans.h"
27 #include "xfs_alloc.h"
28 #include "xfs_dmapi.h"
29 #include "xfs_quota.h"
30 #include "xfs_mount.h"
31 #include "xfs_bmap_btree.h"
32 #include "xfs_alloc_btree.h"
33 #include "xfs_ialloc_btree.h"
34 #include "xfs_attr_sf.h"
35 #include "xfs_dir2_sf.h"
36 #include "xfs_dinode.h"
37 #include "xfs_inode.h"
38 #include "xfs_ialloc.h"
39 #include "xfs_itable.h"
40 #include "xfs_btree.h"
42 #include "xfs_rtalloc.h"
43 #include "xfs_error.h"
47 #include "xfs_buf_item.h"
48 #include "xfs_trans_priv.h"
51 STATIC void xfs_trans_alloc_dqinfo(xfs_trans_t *);
54 * Add the locked dquot to the transaction.
55 * The dquot must be locked, and it cannot be associated with any
65 ASSERT(! XFS_DQ_IS_ADDEDTO_TRX(tp, dqp));
66 ASSERT(XFS_DQ_IS_LOCKED(dqp));
67 ASSERT(XFS_DQ_IS_LOGITEM_INITD(dqp));
71 * Get a log_item_desc to point at the new item.
73 (void) xfs_trans_add_item(tp, (xfs_log_item_t*)(lp));
76 * Initialize i_transp so we can later determine if this dquot is
77 * associated with this transaction.
84 * This is called to mark the dquot as needing
85 * to be logged when the transaction is committed. The dquot must
86 * already be associated with the given transaction.
87 * Note that it marks the entire transaction as dirty. In the ordinary
88 * case, this gets called via xfs_trans_commit, after the transaction
89 * is already dirty. However, there's nothing stop this from getting
90 * called directly, as done by xfs_qm_scall_setqlim. Hence, the TRANS_DIRTY
98 xfs_log_item_desc_t *lidp;
100 ASSERT(XFS_DQ_IS_ADDEDTO_TRX(tp, dqp));
101 ASSERT(XFS_DQ_IS_LOCKED(dqp));
103 lidp = xfs_trans_find_item(tp, (xfs_log_item_t*)(&dqp->q_logitem));
104 ASSERT(lidp != NULL);
106 tp->t_flags |= XFS_TRANS_DIRTY;
107 lidp->lid_flags |= XFS_LID_DIRTY;
111 * Carry forward whatever is left of the quota blk reservation to
112 * the spanky new transaction
115 xfs_trans_dup_dqinfo(
119 xfs_dqtrx_t *oq, *nq;
121 xfs_dqtrx_t *oqa, *nqa;
126 xfs_trans_alloc_dqinfo(ntp);
127 oqa = otp->t_dqinfo->dqa_usrdquots;
128 nqa = ntp->t_dqinfo->dqa_usrdquots;
131 * Because the quota blk reservation is carried forward,
132 * it is also necessary to carry forward the DQ_DIRTY flag.
134 if(otp->t_flags & XFS_TRANS_DQ_DIRTY)
135 ntp->t_flags |= XFS_TRANS_DQ_DIRTY;
137 for (j = 0; j < 2; j++) {
138 for (i = 0; i < XFS_QM_TRANS_MAXDQS; i++) {
139 if (oqa[i].qt_dquot == NULL)
144 nq->qt_dquot = oq->qt_dquot;
145 nq->qt_bcount_delta = nq->qt_icount_delta = 0;
146 nq->qt_rtbcount_delta = 0;
149 * Transfer whatever is left of the reservations.
151 nq->qt_blk_res = oq->qt_blk_res - oq->qt_blk_res_used;
152 oq->qt_blk_res = oq->qt_blk_res_used;
154 nq->qt_rtblk_res = oq->qt_rtblk_res -
155 oq->qt_rtblk_res_used;
156 oq->qt_rtblk_res = oq->qt_rtblk_res_used;
158 nq->qt_ino_res = oq->qt_ino_res - oq->qt_ino_res_used;
159 oq->qt_ino_res = oq->qt_ino_res_used;
162 oqa = otp->t_dqinfo->dqa_grpdquots;
163 nqa = ntp->t_dqinfo->dqa_grpdquots;
168 * Wrap around mod_dquot to account for both user and group quotas.
171 xfs_trans_mod_dquot_byino(
182 if (!XFS_IS_QUOTA_ON(mp) ||
183 ip->i_ino == mp->m_sb.sb_uquotino ||
184 ip->i_ino == mp->m_sb.sb_gquotino)
187 if (tp->t_dqinfo == NULL)
188 xfs_trans_alloc_dqinfo(tp);
190 if (XFS_IS_UQUOTA_ON(mp) && ip->i_udquot)
191 (void) xfs_trans_mod_dquot(tp, ip->i_udquot, field, delta);
192 if (XFS_IS_OQUOTA_ON(mp) && ip->i_gdquot)
193 (void) xfs_trans_mod_dquot(tp, ip->i_gdquot, field, delta);
204 for (i = 0; i < XFS_QM_TRANS_MAXDQS; i++) {
205 qa = XFS_QM_DQP_TO_DQACCT(tp, dqp);
207 if (qa[i].qt_dquot == NULL ||
208 qa[i].qt_dquot == dqp) {
217 * Make the changes in the transaction structure.
218 * The moral equivalent to xfs_trans_mod_sb().
219 * We don't touch any fields in the dquot, so we don't care
220 * if it's locked or not (most of the time it won't be).
234 if (tp->t_dqinfo == NULL)
235 xfs_trans_alloc_dqinfo(tp);
237 * Find either the first free slot or the slot that belongs
240 qtrx = xfs_trans_get_dqtrx(tp, dqp);
242 if (qtrx->qt_dquot == NULL)
243 qtrx->qt_dquot = dqp;
248 * regular disk blk reservation
250 case XFS_TRANS_DQ_RES_BLKS:
251 qtrx->qt_blk_res += (ulong)delta;
257 case XFS_TRANS_DQ_RES_INOS:
258 qtrx->qt_ino_res += (ulong)delta;
264 case XFS_TRANS_DQ_BCOUNT:
265 if (qtrx->qt_blk_res && delta > 0) {
266 qtrx->qt_blk_res_used += (ulong)delta;
267 ASSERT(qtrx->qt_blk_res >= qtrx->qt_blk_res_used);
269 qtrx->qt_bcount_delta += delta;
272 case XFS_TRANS_DQ_DELBCOUNT:
273 qtrx->qt_delbcnt_delta += delta;
279 case XFS_TRANS_DQ_ICOUNT:
280 if (qtrx->qt_ino_res && delta > 0) {
281 qtrx->qt_ino_res_used += (ulong)delta;
282 ASSERT(qtrx->qt_ino_res >= qtrx->qt_ino_res_used);
284 qtrx->qt_icount_delta += delta;
290 case XFS_TRANS_DQ_RES_RTBLKS:
291 qtrx->qt_rtblk_res += (ulong)delta;
297 case XFS_TRANS_DQ_RTBCOUNT:
298 if (qtrx->qt_rtblk_res && delta > 0) {
299 qtrx->qt_rtblk_res_used += (ulong)delta;
300 ASSERT(qtrx->qt_rtblk_res >= qtrx->qt_rtblk_res_used);
302 qtrx->qt_rtbcount_delta += delta;
305 case XFS_TRANS_DQ_DELRTBCOUNT:
306 qtrx->qt_delrtb_delta += delta;
312 tp->t_flags |= XFS_TRANS_DQ_DIRTY;
317 * Given an array of dqtrx structures, lock all the dquots associated
318 * and join them to the transaction, provided they have been modified.
319 * We know that the highest number of dquots (of one type - usr OR grp),
320 * involved in a transaction is 2 and that both usr and grp combined - 3.
321 * So, we don't attempt to make this very generic.
324 xfs_trans_dqlockedjoin(
328 ASSERT(q[0].qt_dquot != NULL);
329 if (q[1].qt_dquot == NULL) {
330 xfs_dqlock(q[0].qt_dquot);
331 xfs_trans_dqjoin(tp, q[0].qt_dquot);
333 ASSERT(XFS_QM_TRANS_MAXDQS == 2);
334 xfs_dqlock2(q[0].qt_dquot, q[1].qt_dquot);
335 xfs_trans_dqjoin(tp, q[0].qt_dquot);
336 xfs_trans_dqjoin(tp, q[1].qt_dquot);
342 * Called by xfs_trans_commit() and similar in spirit to
343 * xfs_trans_apply_sb_deltas().
344 * Go thru all the dquots belonging to this transaction and modify the
345 * INCORE dquot to reflect the actual usages.
346 * Unreserve just the reservations done by this transaction.
347 * dquot is still left locked at exit.
350 xfs_trans_apply_dquot_deltas(
355 xfs_dqtrx_t *qtrx, *qa;
360 if (! (tp->t_flags & XFS_TRANS_DQ_DIRTY))
363 ASSERT(tp->t_dqinfo);
364 qa = tp->t_dqinfo->dqa_usrdquots;
365 for (j = 0; j < 2; j++) {
366 if (qa[0].qt_dquot == NULL) {
367 qa = tp->t_dqinfo->dqa_grpdquots;
372 * Lock all of the dquots and join them to the transaction.
374 xfs_trans_dqlockedjoin(tp, qa);
376 for (i = 0; i < XFS_QM_TRANS_MAXDQS; i++) {
379 * The array of dquots is filled
380 * sequentially, not sparsely.
382 if ((dqp = qtrx->qt_dquot) == NULL)
385 ASSERT(XFS_DQ_IS_LOCKED(dqp));
386 ASSERT(XFS_DQ_IS_ADDEDTO_TRX(tp, dqp));
389 * adjust the actual number of blocks used
394 * The issue here is - sometimes we don't make a blkquota
395 * reservation intentionally to be fair to users
396 * (when the amount is small). On the other hand,
397 * delayed allocs do make reservations, but that's
398 * outside of a transaction, so we have no
399 * idea how much was really reserved.
400 * So, here we've accumulated delayed allocation blks and
401 * non-delay blks. The assumption is that the
402 * delayed ones are always reserved (outside of a
403 * transaction), and the others may or may not have
404 * quota reservations.
406 totalbdelta = qtrx->qt_bcount_delta +
407 qtrx->qt_delbcnt_delta;
408 totalrtbdelta = qtrx->qt_rtbcount_delta +
409 qtrx->qt_delrtb_delta;
412 ASSERT(be64_to_cpu(d->d_bcount) >=
413 (xfs_qcnt_t) -totalbdelta);
415 if (totalrtbdelta < 0)
416 ASSERT(be64_to_cpu(d->d_rtbcount) >=
417 (xfs_qcnt_t) -totalrtbdelta);
419 if (qtrx->qt_icount_delta < 0)
420 ASSERT(be64_to_cpu(d->d_icount) >=
421 (xfs_qcnt_t) -qtrx->qt_icount_delta);
424 be64_add(&d->d_bcount, (xfs_qcnt_t)totalbdelta);
426 if (qtrx->qt_icount_delta)
427 be64_add(&d->d_icount, (xfs_qcnt_t)qtrx->qt_icount_delta);
430 be64_add(&d->d_rtbcount, (xfs_qcnt_t)totalrtbdelta);
433 * Get any default limits in use.
434 * Start/reset the timer(s) if needed.
437 xfs_qm_adjust_dqlimits(tp->t_mountp, d);
438 xfs_qm_adjust_dqtimers(tp->t_mountp, d);
441 dqp->dq_flags |= XFS_DQ_DIRTY;
443 * add this to the list of items to get logged
445 xfs_trans_log_dquot(tp, dqp);
447 * Take off what's left of the original reservation.
448 * In case of delayed allocations, there's no
449 * reservation that a transaction structure knows of.
451 if (qtrx->qt_blk_res != 0) {
452 if (qtrx->qt_blk_res != qtrx->qt_blk_res_used) {
453 if (qtrx->qt_blk_res >
454 qtrx->qt_blk_res_used)
455 dqp->q_res_bcount -= (xfs_qcnt_t)
457 qtrx->qt_blk_res_used);
459 dqp->q_res_bcount -= (xfs_qcnt_t)
460 (qtrx->qt_blk_res_used -
465 * These blks were never reserved, either inside
466 * a transaction or outside one (in a delayed
467 * allocation). Also, this isn't always a
468 * negative number since we sometimes
469 * deliberately skip quota reservations.
471 if (qtrx->qt_bcount_delta) {
473 (xfs_qcnt_t)qtrx->qt_bcount_delta;
477 * Adjust the RT reservation.
479 if (qtrx->qt_rtblk_res != 0) {
480 if (qtrx->qt_rtblk_res != qtrx->qt_rtblk_res_used) {
481 if (qtrx->qt_rtblk_res >
482 qtrx->qt_rtblk_res_used)
483 dqp->q_res_rtbcount -= (xfs_qcnt_t)
484 (qtrx->qt_rtblk_res -
485 qtrx->qt_rtblk_res_used);
487 dqp->q_res_rtbcount -= (xfs_qcnt_t)
488 (qtrx->qt_rtblk_res_used -
492 if (qtrx->qt_rtbcount_delta)
493 dqp->q_res_rtbcount +=
494 (xfs_qcnt_t)qtrx->qt_rtbcount_delta;
498 * Adjust the inode reservation.
500 if (qtrx->qt_ino_res != 0) {
501 ASSERT(qtrx->qt_ino_res >=
502 qtrx->qt_ino_res_used);
503 if (qtrx->qt_ino_res > qtrx->qt_ino_res_used)
504 dqp->q_res_icount -= (xfs_qcnt_t)
506 qtrx->qt_ino_res_used);
508 if (qtrx->qt_icount_delta)
510 (xfs_qcnt_t)qtrx->qt_icount_delta;
513 ASSERT(dqp->q_res_bcount >=
514 be64_to_cpu(dqp->q_core.d_bcount));
515 ASSERT(dqp->q_res_icount >=
516 be64_to_cpu(dqp->q_core.d_icount));
517 ASSERT(dqp->q_res_rtbcount >=
518 be64_to_cpu(dqp->q_core.d_rtbcount));
521 * Do the group quotas next
523 qa = tp->t_dqinfo->dqa_grpdquots;
528 * Release the reservations, and adjust the dquots accordingly.
529 * This is called only when the transaction is being aborted. If by
530 * any chance we have done dquot modifications incore (ie. deltas) already,
531 * we simply throw those away, since that's the expected behavior
532 * when a transaction is curtailed without a commit.
535 xfs_trans_unreserve_and_mod_dquots(
540 xfs_dqtrx_t *qtrx, *qa;
543 if (!tp->t_dqinfo || !(tp->t_flags & XFS_TRANS_DQ_DIRTY))
546 qa = tp->t_dqinfo->dqa_usrdquots;
548 for (j = 0; j < 2; j++) {
549 for (i = 0; i < XFS_QM_TRANS_MAXDQS; i++) {
552 * We assume that the array of dquots is filled
553 * sequentially, not sparsely.
555 if ((dqp = qtrx->qt_dquot) == NULL)
558 * Unreserve the original reservation. We don't care
559 * about the number of blocks used field, or deltas.
560 * Also we don't bother to zero the fields.
563 if (qtrx->qt_blk_res) {
567 (xfs_qcnt_t)qtrx->qt_blk_res;
569 if (qtrx->qt_ino_res) {
575 (xfs_qcnt_t)qtrx->qt_ino_res;
578 if (qtrx->qt_rtblk_res) {
583 dqp->q_res_rtbcount -=
584 (xfs_qcnt_t)qtrx->qt_rtblk_res;
590 qa = tp->t_dqinfo->dqa_grpdquots;
595 xfs_quota_error(uint flags)
597 if (flags & XFS_QMOPT_ENOSPC)
603 * This reserves disk blocks and inodes against a dquot.
604 * Flags indicate if the dquot is to be locked here and also
605 * if the blk reservation is for RT or regular blocks.
606 * Sending in XFS_QMOPT_FORCE_RES flag skips the quota check.
618 xfs_qcnt_t hardlimit;
619 xfs_qcnt_t softlimit;
621 xfs_qwarncnt_t warns;
622 xfs_qwarncnt_t warnlimit;
624 xfs_qcnt_t *resbcountp;
625 xfs_quotainfo_t *q = mp->m_quotainfo;
627 if (! (flags & XFS_QMOPT_DQLOCK)) {
630 ASSERT(XFS_DQ_IS_LOCKED(dqp));
631 if (flags & XFS_TRANS_DQ_RES_BLKS) {
632 hardlimit = be64_to_cpu(dqp->q_core.d_blk_hardlimit);
634 hardlimit = q->qi_bhardlimit;
635 softlimit = be64_to_cpu(dqp->q_core.d_blk_softlimit);
637 softlimit = q->qi_bsoftlimit;
638 timer = be32_to_cpu(dqp->q_core.d_btimer);
639 warns = be16_to_cpu(dqp->q_core.d_bwarns);
640 warnlimit = XFS_QI_BWARNLIMIT(dqp->q_mount);
641 resbcountp = &dqp->q_res_bcount;
643 ASSERT(flags & XFS_TRANS_DQ_RES_RTBLKS);
644 hardlimit = be64_to_cpu(dqp->q_core.d_rtb_hardlimit);
646 hardlimit = q->qi_rtbhardlimit;
647 softlimit = be64_to_cpu(dqp->q_core.d_rtb_softlimit);
649 softlimit = q->qi_rtbsoftlimit;
650 timer = be32_to_cpu(dqp->q_core.d_rtbtimer);
651 warns = be16_to_cpu(dqp->q_core.d_rtbwarns);
652 warnlimit = XFS_QI_RTBWARNLIMIT(dqp->q_mount);
653 resbcountp = &dqp->q_res_rtbcount;
657 if ((flags & XFS_QMOPT_FORCE_RES) == 0 &&
659 ((XFS_IS_UQUOTA_ENFORCED(dqp->q_mount) && XFS_QM_ISUDQ(dqp)) ||
660 (XFS_IS_OQUOTA_ENFORCED(dqp->q_mount) &&
661 (XFS_QM_ISPDQ(dqp) || XFS_QM_ISGDQ(dqp))))) {
663 cmn_err(CE_DEBUG, "BLK Res: nblks=%ld + resbcount=%Ld"
664 " > hardlimit=%Ld?", nblks, *resbcountp, hardlimit);
668 * dquot is locked already. See if we'd go over the
669 * hardlimit or exceed the timelimit if we allocate
672 if (hardlimit > 0ULL &&
673 (hardlimit <= nblks + *resbcountp)) {
674 error = xfs_quota_error(flags);
678 if (softlimit > 0ULL &&
679 (softlimit <= nblks + *resbcountp)) {
680 if ((timer != 0 && get_seconds() > timer) ||
681 (warns != 0 && warns >= warnlimit)) {
682 error = xfs_quota_error(flags);
688 count = be64_to_cpu(dqp->q_core.d_icount);
689 timer = be32_to_cpu(dqp->q_core.d_itimer);
690 warns = be16_to_cpu(dqp->q_core.d_iwarns);
691 warnlimit = XFS_QI_IWARNLIMIT(dqp->q_mount);
692 hardlimit = be64_to_cpu(dqp->q_core.d_ino_hardlimit);
694 hardlimit = q->qi_ihardlimit;
695 softlimit = be64_to_cpu(dqp->q_core.d_ino_softlimit);
697 softlimit = q->qi_isoftlimit;
698 if (hardlimit > 0ULL && count >= hardlimit) {
699 error = xfs_quota_error(flags);
701 } else if (softlimit > 0ULL && count >= softlimit) {
702 if ((timer != 0 && get_seconds() > timer) ||
703 (warns != 0 && warns >= warnlimit)) {
704 error = xfs_quota_error(flags);
712 * Change the reservation, but not the actual usage.
713 * Note that q_res_bcount = q_core.d_bcount + resv
715 (*resbcountp) += (xfs_qcnt_t)nblks;
717 dqp->q_res_icount += (xfs_qcnt_t)ninos;
720 * note the reservation amt in the trans struct too,
721 * so that the transaction knows how much was reserved by
722 * it against this particular dquot.
723 * We don't do this when we are reserving for a delayed allocation,
724 * because we don't have the luxury of a transaction envelope then.
727 ASSERT(tp->t_dqinfo);
728 ASSERT(flags & XFS_QMOPT_RESBLK_MASK);
730 xfs_trans_mod_dquot(tp, dqp,
731 flags & XFS_QMOPT_RESBLK_MASK,
734 xfs_trans_mod_dquot(tp, dqp,
735 XFS_TRANS_DQ_RES_INOS,
738 ASSERT(dqp->q_res_bcount >= be64_to_cpu(dqp->q_core.d_bcount));
739 ASSERT(dqp->q_res_rtbcount >= be64_to_cpu(dqp->q_core.d_rtbcount));
740 ASSERT(dqp->q_res_icount >= be64_to_cpu(dqp->q_core.d_icount));
743 if (! (flags & XFS_QMOPT_DQLOCK)) {
751 * Given dquot(s), make disk block and/or inode reservations against them.
752 * The fact that this does the reservation against both the usr and
753 * grp/prj quotas is important, because this follows a both-or-nothing
756 * flags = XFS_QMOPT_DQLOCK indicate if dquot(s) need to be locked.
757 * XFS_QMOPT_FORCE_RES evades limit enforcement. Used by chown.
758 * XFS_QMOPT_ENOSPC returns ENOSPC not EDQUOT. Used by pquota.
759 * XFS_TRANS_DQ_RES_BLKS reserves regular disk blocks
760 * XFS_TRANS_DQ_RES_RTBLKS reserves realtime disk blocks
761 * dquots are unlocked on return, if they were not locked by caller.
764 xfs_trans_reserve_quota_bydquots(
773 int resvd = 0, error;
775 if (!XFS_IS_QUOTA_ON(mp))
778 if (tp && tp->t_dqinfo == NULL)
779 xfs_trans_alloc_dqinfo(tp);
781 ASSERT(flags & XFS_QMOPT_RESBLK_MASK);
784 error = xfs_trans_dqresv(tp, mp, udqp, nblks, ninos,
785 (flags & ~XFS_QMOPT_ENOSPC));
792 error = xfs_trans_dqresv(tp, mp, gdqp, nblks, ninos, flags);
795 * can't do it, so backout previous reservation
798 flags |= XFS_QMOPT_FORCE_RES;
799 xfs_trans_dqresv(tp, mp, udqp,
800 -nblks, -ninos, flags);
807 * Didn't change anything critical, so, no need to log
814 * Lock the dquot and change the reservation if we can.
815 * This doesn't change the actual usage, just the reservation.
816 * The inode sent in is locked.
819 xfs_trans_reserve_quota_nblks(
829 if (!XFS_IS_QUOTA_ON(mp))
831 if (XFS_IS_PQUOTA_ON(mp))
832 flags |= XFS_QMOPT_ENOSPC;
834 ASSERT(ip->i_ino != mp->m_sb.sb_uquotino);
835 ASSERT(ip->i_ino != mp->m_sb.sb_gquotino);
837 ASSERT(XFS_ISLOCKED_INODE_EXCL(ip));
838 ASSERT(XFS_IS_QUOTA_RUNNING(ip->i_mount));
839 ASSERT((flags & ~(XFS_QMOPT_FORCE_RES | XFS_QMOPT_ENOSPC)) ==
840 XFS_TRANS_DQ_RES_RTBLKS ||
841 (flags & ~(XFS_QMOPT_FORCE_RES | XFS_QMOPT_ENOSPC)) ==
842 XFS_TRANS_DQ_RES_BLKS);
845 * Reserve nblks against these dquots, with trans as the mediator.
847 error = xfs_trans_reserve_quota_bydquots(tp, mp,
848 ip->i_udquot, ip->i_gdquot,
855 * This routine is called to allocate a quotaoff log item.
858 xfs_trans_get_qoff_item(
860 xfs_qoff_logitem_t *startqoff,
863 xfs_qoff_logitem_t *q;
867 q = xfs_qm_qoff_logitem_init(tp->t_mountp, startqoff, flags);
871 * Get a log_item_desc to point at the new item.
873 (void) xfs_trans_add_item(tp, (xfs_log_item_t*)q);
880 * This is called to mark the quotaoff logitem as needing
881 * to be logged when the transaction is committed. The logitem must
882 * already be associated with the given transaction.
885 xfs_trans_log_quotaoff_item(
887 xfs_qoff_logitem_t *qlp)
889 xfs_log_item_desc_t *lidp;
891 lidp = xfs_trans_find_item(tp, (xfs_log_item_t *)qlp);
892 ASSERT(lidp != NULL);
894 tp->t_flags |= XFS_TRANS_DIRTY;
895 lidp->lid_flags |= XFS_LID_DIRTY;
899 xfs_trans_alloc_dqinfo(
902 (tp)->t_dqinfo = kmem_zone_zalloc(xfs_Gqm->qm_dqtrxzone, KM_SLEEP);
906 xfs_trans_free_dqinfo(
911 kmem_zone_free(xfs_Gqm->qm_dqtrxzone, (tp)->t_dqinfo);
912 (tp)->t_dqinfo = NULL;
915 xfs_dqtrxops_t xfs_trans_dquot_ops = {
916 .qo_dup_dqinfo = xfs_trans_dup_dqinfo,
917 .qo_free_dqinfo = xfs_trans_free_dqinfo,
918 .qo_mod_dquot_byino = xfs_trans_mod_dquot_byino,
919 .qo_apply_dquot_deltas = xfs_trans_apply_dquot_deltas,
920 .qo_reserve_quota_nblks = xfs_trans_reserve_quota_nblks,
921 .qo_reserve_quota_bydquots = xfs_trans_reserve_quota_bydquots,
922 .qo_unreserve_and_mod_dquots = xfs_trans_unreserve_and_mod_dquots,