2 * Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License as
6 * published by the Free Software Foundation.
8 * This program is distributed in the hope that it would be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 * Further, this software is distributed without any warranty that it is
13 * free of the rightful claim of any third person regarding infringement
14 * or the like. Any license provided herein, whether implied or
15 * otherwise, applies only to this software file. Patent licenses, if
16 * any, provided herein do not apply to combinations of this program with
17 * other software, or any other product whatsoever.
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write the Free Software Foundation, Inc., 59
21 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
28 * For further information regarding this notice, see:
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
37 #include "xfs_trans.h"
42 #include "xfs_alloc.h"
43 #include "xfs_dmapi.h"
44 #include "xfs_quota.h"
45 #include "xfs_mount.h"
46 #include "xfs_alloc_btree.h"
47 #include "xfs_bmap_btree.h"
48 #include "xfs_ialloc_btree.h"
49 #include "xfs_btree.h"
50 #include "xfs_ialloc.h"
51 #include "xfs_attr_sf.h"
52 #include "xfs_dir_sf.h"
53 #include "xfs_dir2_sf.h"
54 #include "xfs_dinode.h"
55 #include "xfs_inode.h"
58 #include "xfs_rtalloc.h"
59 #include "xfs_error.h"
60 #include "xfs_itable.h"
66 #include "xfs_buf_item.h"
67 #include "xfs_trans_priv.h"
71 STATIC void xfs_trans_alloc_dqinfo(xfs_trans_t *);
74 * Add the locked dquot to the transaction.
75 * The dquot must be locked, and it cannot be associated with any
85 ASSERT(! XFS_DQ_IS_ADDEDTO_TRX(tp, dqp));
86 ASSERT(XFS_DQ_IS_LOCKED(dqp));
87 ASSERT(XFS_DQ_IS_LOGITEM_INITD(dqp));
91 * Get a log_item_desc to point at the new item.
93 (void) xfs_trans_add_item(tp, (xfs_log_item_t*)(lp));
96 * Initialize i_transp so we can later determine if this dquot is
97 * associated with this transaction.
104 * This is called to mark the dquot as needing
105 * to be logged when the transaction is committed. The dquot must
106 * already be associated with the given transaction.
107 * Note that it marks the entire transaction as dirty. In the ordinary
108 * case, this gets called via xfs_trans_commit, after the transaction
109 * is already dirty. However, there's nothing stop this from getting
110 * called directly, as done by xfs_qm_scall_setqlim. Hence, the TRANS_DIRTY
118 xfs_log_item_desc_t *lidp;
120 ASSERT(XFS_DQ_IS_ADDEDTO_TRX(tp, dqp));
121 ASSERT(XFS_DQ_IS_LOCKED(dqp));
123 lidp = xfs_trans_find_item(tp, (xfs_log_item_t*)(&dqp->q_logitem));
124 ASSERT(lidp != NULL);
126 tp->t_flags |= XFS_TRANS_DIRTY;
127 lidp->lid_flags |= XFS_LID_DIRTY;
131 * Carry forward whatever is left of the quota blk reservation to
132 * the spanky new transaction
135 xfs_trans_dup_dqinfo(
139 xfs_dqtrx_t *oq, *nq;
141 xfs_dqtrx_t *oqa, *nqa;
146 xfs_trans_alloc_dqinfo(ntp);
147 oqa = otp->t_dqinfo->dqa_usrdquots;
148 nqa = ntp->t_dqinfo->dqa_usrdquots;
151 * Because the quota blk reservation is carried forward,
152 * it is also necessary to carry forward the DQ_DIRTY flag.
154 if(otp->t_flags & XFS_TRANS_DQ_DIRTY)
155 ntp->t_flags |= XFS_TRANS_DQ_DIRTY;
157 for (j = 0; j < 2; j++) {
158 for (i = 0; i < XFS_QM_TRANS_MAXDQS; i++) {
159 if (oqa[i].qt_dquot == NULL)
164 nq->qt_dquot = oq->qt_dquot;
165 nq->qt_bcount_delta = nq->qt_icount_delta = 0;
166 nq->qt_rtbcount_delta = 0;
169 * Transfer whatever is left of the reservations.
171 nq->qt_blk_res = oq->qt_blk_res - oq->qt_blk_res_used;
172 oq->qt_blk_res = oq->qt_blk_res_used;
174 nq->qt_rtblk_res = oq->qt_rtblk_res -
175 oq->qt_rtblk_res_used;
176 oq->qt_rtblk_res = oq->qt_rtblk_res_used;
178 nq->qt_ino_res = oq->qt_ino_res - oq->qt_ino_res_used;
179 oq->qt_ino_res = oq->qt_ino_res_used;
182 oqa = otp->t_dqinfo->dqa_grpdquots;
183 nqa = ntp->t_dqinfo->dqa_grpdquots;
188 * Wrap around mod_dquot to account for both user and group quotas.
191 xfs_trans_mod_dquot_byino(
202 if (!XFS_IS_QUOTA_ON(mp) ||
203 ip->i_ino == mp->m_sb.sb_uquotino ||
204 ip->i_ino == mp->m_sb.sb_gquotino)
207 if (tp->t_dqinfo == NULL)
208 xfs_trans_alloc_dqinfo(tp);
210 if (XFS_IS_UQUOTA_ON(mp) && ip->i_udquot)
211 (void) xfs_trans_mod_dquot(tp, ip->i_udquot, field, delta);
212 if (XFS_IS_OQUOTA_ON(mp) && ip->i_gdquot)
213 (void) xfs_trans_mod_dquot(tp, ip->i_gdquot, field, delta);
224 for (i = 0; i < XFS_QM_TRANS_MAXDQS; i++) {
225 qa = XFS_QM_DQP_TO_DQACCT(tp, dqp);
227 if (qa[i].qt_dquot == NULL ||
228 qa[i].qt_dquot == dqp) {
237 * Make the changes in the transaction structure.
238 * The moral equivalent to xfs_trans_mod_sb().
239 * We don't touch any fields in the dquot, so we don't care
240 * if it's locked or not (most of the time it won't be).
254 if (tp->t_dqinfo == NULL)
255 xfs_trans_alloc_dqinfo(tp);
257 * Find either the first free slot or the slot that belongs
260 qtrx = xfs_trans_get_dqtrx(tp, dqp);
262 if (qtrx->qt_dquot == NULL)
263 qtrx->qt_dquot = dqp;
268 * regular disk blk reservation
270 case XFS_TRANS_DQ_RES_BLKS:
271 qtrx->qt_blk_res += (ulong)delta;
277 case XFS_TRANS_DQ_RES_INOS:
278 qtrx->qt_ino_res += (ulong)delta;
284 case XFS_TRANS_DQ_BCOUNT:
285 if (qtrx->qt_blk_res && delta > 0) {
286 qtrx->qt_blk_res_used += (ulong)delta;
287 ASSERT(qtrx->qt_blk_res >= qtrx->qt_blk_res_used);
289 qtrx->qt_bcount_delta += delta;
292 case XFS_TRANS_DQ_DELBCOUNT:
293 qtrx->qt_delbcnt_delta += delta;
299 case XFS_TRANS_DQ_ICOUNT:
300 if (qtrx->qt_ino_res && delta > 0) {
301 qtrx->qt_ino_res_used += (ulong)delta;
302 ASSERT(qtrx->qt_ino_res >= qtrx->qt_ino_res_used);
304 qtrx->qt_icount_delta += delta;
310 case XFS_TRANS_DQ_RES_RTBLKS:
311 qtrx->qt_rtblk_res += (ulong)delta;
317 case XFS_TRANS_DQ_RTBCOUNT:
318 if (qtrx->qt_rtblk_res && delta > 0) {
319 qtrx->qt_rtblk_res_used += (ulong)delta;
320 ASSERT(qtrx->qt_rtblk_res >= qtrx->qt_rtblk_res_used);
322 qtrx->qt_rtbcount_delta += delta;
325 case XFS_TRANS_DQ_DELRTBCOUNT:
326 qtrx->qt_delrtb_delta += delta;
332 tp->t_flags |= XFS_TRANS_DQ_DIRTY;
337 * Given an array of dqtrx structures, lock all the dquots associated
338 * and join them to the transaction, provided they have been modified.
339 * We know that the highest number of dquots (of one type - usr OR grp),
340 * involved in a transaction is 2 and that both usr and grp combined - 3.
341 * So, we don't attempt to make this very generic.
344 xfs_trans_dqlockedjoin(
348 ASSERT(q[0].qt_dquot != NULL);
349 if (q[1].qt_dquot == NULL) {
350 xfs_dqlock(q[0].qt_dquot);
351 xfs_trans_dqjoin(tp, q[0].qt_dquot);
353 ASSERT(XFS_QM_TRANS_MAXDQS == 2);
354 xfs_dqlock2(q[0].qt_dquot, q[1].qt_dquot);
355 xfs_trans_dqjoin(tp, q[0].qt_dquot);
356 xfs_trans_dqjoin(tp, q[1].qt_dquot);
362 * Called by xfs_trans_commit() and similar in spirit to
363 * xfs_trans_apply_sb_deltas().
364 * Go thru all the dquots belonging to this transaction and modify the
365 * INCORE dquot to reflect the actual usages.
366 * Unreserve just the reservations done by this transaction.
367 * dquot is still left locked at exit.
370 xfs_trans_apply_dquot_deltas(
375 xfs_dqtrx_t *qtrx, *qa;
380 if (! (tp->t_flags & XFS_TRANS_DQ_DIRTY))
383 ASSERT(tp->t_dqinfo);
384 qa = tp->t_dqinfo->dqa_usrdquots;
385 for (j = 0; j < 2; j++) {
386 if (qa[0].qt_dquot == NULL) {
387 qa = tp->t_dqinfo->dqa_grpdquots;
392 * Lock all of the dquots and join them to the transaction.
394 xfs_trans_dqlockedjoin(tp, qa);
396 for (i = 0; i < XFS_QM_TRANS_MAXDQS; i++) {
399 * The array of dquots is filled
400 * sequentially, not sparsely.
402 if ((dqp = qtrx->qt_dquot) == NULL)
405 ASSERT(XFS_DQ_IS_LOCKED(dqp));
406 ASSERT(XFS_DQ_IS_ADDEDTO_TRX(tp, dqp));
409 * adjust the actual number of blocks used
414 * The issue here is - sometimes we don't make a blkquota
415 * reservation intentionally to be fair to users
416 * (when the amount is small). On the other hand,
417 * delayed allocs do make reservations, but that's
418 * outside of a transaction, so we have no
419 * idea how much was really reserved.
420 * So, here we've accumulated delayed allocation blks and
421 * non-delay blks. The assumption is that the
422 * delayed ones are always reserved (outside of a
423 * transaction), and the others may or may not have
424 * quota reservations.
426 totalbdelta = qtrx->qt_bcount_delta +
427 qtrx->qt_delbcnt_delta;
428 totalrtbdelta = qtrx->qt_rtbcount_delta +
429 qtrx->qt_delrtb_delta;
432 ASSERT(INT_GET(d->d_bcount, ARCH_CONVERT) >=
433 (xfs_qcnt_t) -totalbdelta);
435 if (totalrtbdelta < 0)
436 ASSERT(INT_GET(d->d_rtbcount, ARCH_CONVERT) >=
437 (xfs_qcnt_t) -totalrtbdelta);
439 if (qtrx->qt_icount_delta < 0)
440 ASSERT(INT_GET(d->d_icount, ARCH_CONVERT) >=
441 (xfs_qcnt_t) -qtrx->qt_icount_delta);
444 INT_MOD(d->d_bcount, ARCH_CONVERT, (xfs_qcnt_t)totalbdelta);
446 if (qtrx->qt_icount_delta)
447 INT_MOD(d->d_icount, ARCH_CONVERT, (xfs_qcnt_t)qtrx->qt_icount_delta);
450 INT_MOD(d->d_rtbcount, ARCH_CONVERT, (xfs_qcnt_t)totalrtbdelta);
453 * Get any default limits in use.
454 * Start/reset the timer(s) if needed.
457 xfs_qm_adjust_dqlimits(tp->t_mountp, d);
458 xfs_qm_adjust_dqtimers(tp->t_mountp, d);
461 dqp->dq_flags |= XFS_DQ_DIRTY;
463 * add this to the list of items to get logged
465 xfs_trans_log_dquot(tp, dqp);
467 * Take off what's left of the original reservation.
468 * In case of delayed allocations, there's no
469 * reservation that a transaction structure knows of.
471 if (qtrx->qt_blk_res != 0) {
472 if (qtrx->qt_blk_res != qtrx->qt_blk_res_used) {
473 if (qtrx->qt_blk_res >
474 qtrx->qt_blk_res_used)
475 dqp->q_res_bcount -= (xfs_qcnt_t)
477 qtrx->qt_blk_res_used);
479 dqp->q_res_bcount -= (xfs_qcnt_t)
480 (qtrx->qt_blk_res_used -
485 * These blks were never reserved, either inside
486 * a transaction or outside one (in a delayed
487 * allocation). Also, this isn't always a
488 * negative number since we sometimes
489 * deliberately skip quota reservations.
491 if (qtrx->qt_bcount_delta) {
493 (xfs_qcnt_t)qtrx->qt_bcount_delta;
497 * Adjust the RT reservation.
499 if (qtrx->qt_rtblk_res != 0) {
500 if (qtrx->qt_rtblk_res != qtrx->qt_rtblk_res_used) {
501 if (qtrx->qt_rtblk_res >
502 qtrx->qt_rtblk_res_used)
503 dqp->q_res_rtbcount -= (xfs_qcnt_t)
504 (qtrx->qt_rtblk_res -
505 qtrx->qt_rtblk_res_used);
507 dqp->q_res_rtbcount -= (xfs_qcnt_t)
508 (qtrx->qt_rtblk_res_used -
512 if (qtrx->qt_rtbcount_delta)
513 dqp->q_res_rtbcount +=
514 (xfs_qcnt_t)qtrx->qt_rtbcount_delta;
518 * Adjust the inode reservation.
520 if (qtrx->qt_ino_res != 0) {
521 ASSERT(qtrx->qt_ino_res >=
522 qtrx->qt_ino_res_used);
523 if (qtrx->qt_ino_res > qtrx->qt_ino_res_used)
524 dqp->q_res_icount -= (xfs_qcnt_t)
526 qtrx->qt_ino_res_used);
528 if (qtrx->qt_icount_delta)
530 (xfs_qcnt_t)qtrx->qt_icount_delta;
533 ASSERT(dqp->q_res_bcount >=
534 INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT));
535 ASSERT(dqp->q_res_icount >=
536 INT_GET(dqp->q_core.d_icount, ARCH_CONVERT));
537 ASSERT(dqp->q_res_rtbcount >=
538 INT_GET(dqp->q_core.d_rtbcount, ARCH_CONVERT));
541 * Do the group quotas next
543 qa = tp->t_dqinfo->dqa_grpdquots;
548 * Release the reservations, and adjust the dquots accordingly.
549 * This is called only when the transaction is being aborted. If by
550 * any chance we have done dquot modifications incore (ie. deltas) already,
551 * we simply throw those away, since that's the expected behavior
552 * when a transaction is curtailed without a commit.
555 xfs_trans_unreserve_and_mod_dquots(
560 xfs_dqtrx_t *qtrx, *qa;
563 if (!tp->t_dqinfo || !(tp->t_flags & XFS_TRANS_DQ_DIRTY))
566 qa = tp->t_dqinfo->dqa_usrdquots;
568 for (j = 0; j < 2; j++) {
569 for (i = 0; i < XFS_QM_TRANS_MAXDQS; i++) {
572 * We assume that the array of dquots is filled
573 * sequentially, not sparsely.
575 if ((dqp = qtrx->qt_dquot) == NULL)
578 * Unreserve the original reservation. We don't care
579 * about the number of blocks used field, or deltas.
580 * Also we don't bother to zero the fields.
583 if (qtrx->qt_blk_res) {
587 (xfs_qcnt_t)qtrx->qt_blk_res;
589 if (qtrx->qt_ino_res) {
595 (xfs_qcnt_t)qtrx->qt_ino_res;
598 if (qtrx->qt_rtblk_res) {
603 dqp->q_res_rtbcount -=
604 (xfs_qcnt_t)qtrx->qt_rtblk_res;
610 qa = tp->t_dqinfo->dqa_grpdquots;
615 * This reserves disk blocks and inodes against a dquot.
616 * Flags indicate if the dquot is to be locked here and also
617 * if the blk reservation is for RT or regular blocks.
618 * Sending in XFS_QMOPT_FORCE_RES flag skips the quota check.
619 * Returns EDQUOT if quota is exceeded.
631 xfs_qcnt_t hardlimit;
632 xfs_qcnt_t softlimit;
634 xfs_qwarncnt_t warns;
635 xfs_qwarncnt_t warnlimit;
637 xfs_qcnt_t *resbcountp;
638 xfs_quotainfo_t *q = mp->m_quotainfo;
640 if (! (flags & XFS_QMOPT_DQLOCK)) {
643 ASSERT(XFS_DQ_IS_LOCKED(dqp));
644 if (flags & XFS_TRANS_DQ_RES_BLKS) {
645 hardlimit = INT_GET(dqp->q_core.d_blk_hardlimit, ARCH_CONVERT);
647 hardlimit = q->qi_bhardlimit;
648 softlimit = INT_GET(dqp->q_core.d_blk_softlimit, ARCH_CONVERT);
650 softlimit = q->qi_bsoftlimit;
651 timer = INT_GET(dqp->q_core.d_btimer, ARCH_CONVERT);
652 warns = INT_GET(dqp->q_core.d_bwarns, ARCH_CONVERT);
653 warnlimit = XFS_QI_BWARNLIMIT(dqp->q_mount);
654 resbcountp = &dqp->q_res_bcount;
656 ASSERT(flags & XFS_TRANS_DQ_RES_RTBLKS);
657 hardlimit = INT_GET(dqp->q_core.d_rtb_hardlimit, ARCH_CONVERT);
659 hardlimit = q->qi_rtbhardlimit;
660 softlimit = INT_GET(dqp->q_core.d_rtb_softlimit, ARCH_CONVERT);
662 softlimit = q->qi_rtbsoftlimit;
663 timer = INT_GET(dqp->q_core.d_rtbtimer, ARCH_CONVERT);
664 warns = INT_GET(dqp->q_core.d_rtbwarns, ARCH_CONVERT);
665 warnlimit = XFS_QI_RTBWARNLIMIT(dqp->q_mount);
666 resbcountp = &dqp->q_res_rtbcount;
670 if ((flags & XFS_QMOPT_FORCE_RES) == 0 &&
672 XFS_IS_QUOTA_ENFORCED(dqp->q_mount)) {
674 cmn_err(CE_DEBUG, "BLK Res: nblks=%ld + resbcount=%Ld"
675 " > hardlimit=%Ld?", nblks, *resbcountp, hardlimit);
679 * dquot is locked already. See if we'd go over the
680 * hardlimit or exceed the timelimit if we allocate
683 if (hardlimit > 0ULL &&
684 (hardlimit <= nblks + *resbcountp)) {
689 if (softlimit > 0ULL &&
690 (softlimit <= nblks + *resbcountp)) {
692 * If timer or warnings has expired,
695 if ((timer != 0 && get_seconds() > timer) ||
696 (warns != 0 && warns >= warnlimit)) {
703 count = INT_GET(dqp->q_core.d_icount, ARCH_CONVERT);
704 timer = INT_GET(dqp->q_core.d_itimer, ARCH_CONVERT);
705 warns = INT_GET(dqp->q_core.d_iwarns, ARCH_CONVERT);
706 warnlimit = XFS_QI_IWARNLIMIT(dqp->q_mount);
707 hardlimit = INT_GET(dqp->q_core.d_ino_hardlimit,
710 hardlimit = q->qi_ihardlimit;
711 softlimit = INT_GET(dqp->q_core.d_ino_softlimit,
714 softlimit = q->qi_isoftlimit;
715 if (hardlimit > 0ULL && count >= hardlimit) {
718 } else if (softlimit > 0ULL && count >= softlimit) {
720 * If timer or warnings has expired,
723 if ((timer != 0 && get_seconds() > timer) ||
724 (warns != 0 && warns >= warnlimit)) {
733 * Change the reservation, but not the actual usage.
734 * Note that q_res_bcount = q_core.d_bcount + resv
736 (*resbcountp) += (xfs_qcnt_t)nblks;
738 dqp->q_res_icount += (xfs_qcnt_t)ninos;
741 * note the reservation amt in the trans struct too,
742 * so that the transaction knows how much was reserved by
743 * it against this particular dquot.
744 * We don't do this when we are reserving for a delayed allocation,
745 * because we don't have the luxury of a transaction envelope then.
748 ASSERT(tp->t_dqinfo);
749 ASSERT(flags & XFS_QMOPT_RESBLK_MASK);
751 xfs_trans_mod_dquot(tp, dqp,
752 flags & XFS_QMOPT_RESBLK_MASK,
755 xfs_trans_mod_dquot(tp, dqp,
756 XFS_TRANS_DQ_RES_INOS,
759 ASSERT(dqp->q_res_bcount >= INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT));
760 ASSERT(dqp->q_res_rtbcount >= INT_GET(dqp->q_core.d_rtbcount, ARCH_CONVERT));
761 ASSERT(dqp->q_res_icount >= INT_GET(dqp->q_core.d_icount, ARCH_CONVERT));
764 if (! (flags & XFS_QMOPT_DQLOCK)) {
772 * Given a dquot(s), make disk block and/or inode reservations against them.
773 * The fact that this does the reservation against both the usr and
774 * grp quotas is important, because this follows a both-or-nothing
777 * flags = XFS_QMOPT_DQLOCK indicate if dquot(s) need to be locked.
778 * XFS_QMOPT_FORCE_RES evades limit enforcement. Used by chown.
779 * XFS_TRANS_DQ_RES_BLKS reserves regular disk blocks
780 * XFS_TRANS_DQ_RES_RTBLKS reserves realtime disk blocks
781 * dquots are unlocked on return, if they were not locked by caller.
784 xfs_trans_reserve_quota_bydquots(
795 if (! XFS_IS_QUOTA_ON(mp))
798 if (tp && tp->t_dqinfo == NULL)
799 xfs_trans_alloc_dqinfo(tp);
801 ASSERT(flags & XFS_QMOPT_RESBLK_MASK);
805 if (xfs_trans_dqresv(tp, mp, udqp, nblks, ninos, flags))
811 if (xfs_trans_dqresv(tp, mp, gdqp, nblks, ninos, flags)) {
813 * can't do it, so backout previous reservation
816 flags |= XFS_QMOPT_FORCE_RES;
817 xfs_trans_dqresv(tp, mp, udqp,
818 -nblks, -ninos, flags);
825 * Didnt change anything critical, so, no need to log
832 * Lock the dquot and change the reservation if we can.
833 * This doesn't change the actual usage, just the reservation.
834 * The inode sent in is locked.
836 * Returns 0 on success, EDQUOT or other errors otherwise
839 xfs_trans_reserve_quota_nblks(
849 if (!XFS_IS_QUOTA_ON(mp))
852 ASSERT(ip->i_ino != mp->m_sb.sb_uquotino);
853 ASSERT(ip->i_ino != mp->m_sb.sb_gquotino);
855 ASSERT(XFS_ISLOCKED_INODE_EXCL(ip));
856 ASSERT(XFS_IS_QUOTA_RUNNING(ip->i_mount));
857 ASSERT((type & ~XFS_QMOPT_FORCE_RES) == XFS_TRANS_DQ_RES_RTBLKS ||
858 (type & ~XFS_QMOPT_FORCE_RES) == XFS_TRANS_DQ_RES_BLKS);
861 * Reserve nblks against these dquots, with trans as the mediator.
863 error = xfs_trans_reserve_quota_bydquots(tp, mp,
864 ip->i_udquot, ip->i_gdquot,
871 * This routine is called to allocate a quotaoff log item.
874 xfs_trans_get_qoff_item(
876 xfs_qoff_logitem_t *startqoff,
879 xfs_qoff_logitem_t *q;
883 q = xfs_qm_qoff_logitem_init(tp->t_mountp, startqoff, flags);
887 * Get a log_item_desc to point at the new item.
889 (void) xfs_trans_add_item(tp, (xfs_log_item_t*)q);
896 * This is called to mark the quotaoff logitem as needing
897 * to be logged when the transaction is committed. The logitem must
898 * already be associated with the given transaction.
901 xfs_trans_log_quotaoff_item(
903 xfs_qoff_logitem_t *qlp)
905 xfs_log_item_desc_t *lidp;
907 lidp = xfs_trans_find_item(tp, (xfs_log_item_t *)qlp);
908 ASSERT(lidp != NULL);
910 tp->t_flags |= XFS_TRANS_DIRTY;
911 lidp->lid_flags |= XFS_LID_DIRTY;
915 xfs_trans_alloc_dqinfo(
918 (tp)->t_dqinfo = kmem_zone_zalloc(xfs_Gqm->qm_dqtrxzone, KM_SLEEP);
922 xfs_trans_free_dqinfo(
927 kmem_zone_free(xfs_Gqm->qm_dqtrxzone, (tp)->t_dqinfo);
928 (tp)->t_dqinfo = NULL;
931 xfs_dqtrxops_t xfs_trans_dquot_ops = {
932 .qo_dup_dqinfo = xfs_trans_dup_dqinfo,
933 .qo_free_dqinfo = xfs_trans_free_dqinfo,
934 .qo_mod_dquot_byino = xfs_trans_mod_dquot_byino,
935 .qo_apply_dquot_deltas = xfs_trans_apply_dquot_deltas,
936 .qo_reserve_quota_nblks = xfs_trans_reserve_quota_nblks,
937 .qo_reserve_quota_bydquots = xfs_trans_reserve_quota_bydquots,
938 .qo_unreserve_and_mod_dquots = xfs_trans_unreserve_and_mod_dquots,