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
20 #include "xfs_shared.h"
21 #include "xfs_format.h"
22 #include "xfs_log_format.h"
23 #include "xfs_trans_resv.h"
25 #include "xfs_mount.h"
26 #include "xfs_inode.h"
27 #include "xfs_error.h"
28 #include "xfs_trans.h"
29 #include "xfs_trans_priv.h"
30 #include "xfs_quota.h"
33 STATIC void xfs_trans_alloc_dqinfo(xfs_trans_t *);
36 * Add the locked dquot to the transaction.
37 * The dquot must be locked, and it cannot be associated with any
45 ASSERT(dqp->q_transp != tp);
46 ASSERT(XFS_DQ_IS_LOCKED(dqp));
47 ASSERT(dqp->q_logitem.qli_dquot == dqp);
50 * Get a log_item_desc to point at the new item.
52 xfs_trans_add_item(tp, &dqp->q_logitem.qli_item);
55 * Initialize d_transp so we can later determine if this dquot is
56 * associated with this transaction.
63 * This is called to mark the dquot as needing
64 * to be logged when the transaction is committed. The dquot must
65 * already be associated with the given transaction.
66 * Note that it marks the entire transaction as dirty. In the ordinary
67 * case, this gets called via xfs_trans_commit, after the transaction
68 * is already dirty. However, there's nothing stop this from getting
69 * called directly, as done by xfs_qm_scall_setqlim. Hence, the TRANS_DIRTY
77 ASSERT(dqp->q_transp == tp);
78 ASSERT(XFS_DQ_IS_LOCKED(dqp));
80 tp->t_flags |= XFS_TRANS_DIRTY;
81 dqp->q_logitem.qli_item.li_desc->lid_flags |= XFS_LID_DIRTY;
85 * Carry forward whatever is left of the quota blk reservation to
86 * the spanky new transaction
95 xfs_dqtrx_t *oqa, *nqa;
100 xfs_trans_alloc_dqinfo(ntp);
103 * Because the quota blk reservation is carried forward,
104 * it is also necessary to carry forward the DQ_DIRTY flag.
106 if(otp->t_flags & XFS_TRANS_DQ_DIRTY)
107 ntp->t_flags |= XFS_TRANS_DQ_DIRTY;
109 for (j = 0; j < XFS_QM_TRANS_DQTYPES; j++) {
110 oqa = otp->t_dqinfo->dqs[j];
111 nqa = ntp->t_dqinfo->dqs[j];
112 for (i = 0; i < XFS_QM_TRANS_MAXDQS; i++) {
113 if (oqa[i].qt_dquot == NULL)
118 nq->qt_dquot = oq->qt_dquot;
119 nq->qt_bcount_delta = nq->qt_icount_delta = 0;
120 nq->qt_rtbcount_delta = 0;
123 * Transfer whatever is left of the reservations.
125 nq->qt_blk_res = oq->qt_blk_res - oq->qt_blk_res_used;
126 oq->qt_blk_res = oq->qt_blk_res_used;
128 nq->qt_rtblk_res = oq->qt_rtblk_res -
129 oq->qt_rtblk_res_used;
130 oq->qt_rtblk_res = oq->qt_rtblk_res_used;
132 nq->qt_ino_res = oq->qt_ino_res - oq->qt_ino_res_used;
133 oq->qt_ino_res = oq->qt_ino_res_used;
140 * Wrap around mod_dquot to account for both user and group quotas.
143 xfs_trans_mod_dquot_byino(
149 xfs_mount_t *mp = tp->t_mountp;
151 if (!XFS_IS_QUOTA_RUNNING(mp) ||
152 !XFS_IS_QUOTA_ON(mp) ||
153 xfs_is_quota_inode(&mp->m_sb, ip->i_ino))
156 if (tp->t_dqinfo == NULL)
157 xfs_trans_alloc_dqinfo(tp);
159 if (XFS_IS_UQUOTA_ON(mp) && ip->i_udquot)
160 (void) xfs_trans_mod_dquot(tp, ip->i_udquot, field, delta);
161 if (XFS_IS_GQUOTA_ON(mp) && ip->i_gdquot)
162 (void) xfs_trans_mod_dquot(tp, ip->i_gdquot, field, delta);
163 if (XFS_IS_PQUOTA_ON(mp) && ip->i_pdquot)
164 (void) xfs_trans_mod_dquot(tp, ip->i_pdquot, field, delta);
167 STATIC struct xfs_dqtrx *
169 struct xfs_trans *tp,
170 struct xfs_dquot *dqp)
173 struct xfs_dqtrx *qa;
175 if (XFS_QM_ISUDQ(dqp))
176 qa = tp->t_dqinfo->dqs[XFS_QM_TRANS_USR];
177 else if (XFS_QM_ISGDQ(dqp))
178 qa = tp->t_dqinfo->dqs[XFS_QM_TRANS_GRP];
179 else if (XFS_QM_ISPDQ(dqp))
180 qa = tp->t_dqinfo->dqs[XFS_QM_TRANS_PRJ];
184 for (i = 0; i < XFS_QM_TRANS_MAXDQS; i++) {
185 if (qa[i].qt_dquot == NULL ||
186 qa[i].qt_dquot == dqp)
194 * Make the changes in the transaction structure.
195 * The moral equivalent to xfs_trans_mod_sb().
196 * We don't touch any fields in the dquot, so we don't care
197 * if it's locked or not (most of the time it won't be).
209 ASSERT(XFS_IS_QUOTA_RUNNING(tp->t_mountp));
212 if (tp->t_dqinfo == NULL)
213 xfs_trans_alloc_dqinfo(tp);
215 * Find either the first free slot or the slot that belongs
218 qtrx = xfs_trans_get_dqtrx(tp, dqp);
220 if (qtrx->qt_dquot == NULL)
221 qtrx->qt_dquot = dqp;
226 * regular disk blk reservation
228 case XFS_TRANS_DQ_RES_BLKS:
229 qtrx->qt_blk_res += (ulong)delta;
235 case XFS_TRANS_DQ_RES_INOS:
236 qtrx->qt_ino_res += (ulong)delta;
242 case XFS_TRANS_DQ_BCOUNT:
243 if (qtrx->qt_blk_res && delta > 0) {
244 qtrx->qt_blk_res_used += (ulong)delta;
245 ASSERT(qtrx->qt_blk_res >= qtrx->qt_blk_res_used);
247 qtrx->qt_bcount_delta += delta;
250 case XFS_TRANS_DQ_DELBCOUNT:
251 qtrx->qt_delbcnt_delta += delta;
257 case XFS_TRANS_DQ_ICOUNT:
258 if (qtrx->qt_ino_res && delta > 0) {
259 qtrx->qt_ino_res_used += (ulong)delta;
260 ASSERT(qtrx->qt_ino_res >= qtrx->qt_ino_res_used);
262 qtrx->qt_icount_delta += delta;
268 case XFS_TRANS_DQ_RES_RTBLKS:
269 qtrx->qt_rtblk_res += (ulong)delta;
275 case XFS_TRANS_DQ_RTBCOUNT:
276 if (qtrx->qt_rtblk_res && delta > 0) {
277 qtrx->qt_rtblk_res_used += (ulong)delta;
278 ASSERT(qtrx->qt_rtblk_res >= qtrx->qt_rtblk_res_used);
280 qtrx->qt_rtbcount_delta += delta;
283 case XFS_TRANS_DQ_DELRTBCOUNT:
284 qtrx->qt_delrtb_delta += delta;
290 tp->t_flags |= XFS_TRANS_DQ_DIRTY;
295 * Given an array of dqtrx structures, lock all the dquots associated and join
296 * them to the transaction, provided they have been modified. We know that the
297 * highest number of dquots of one type - usr, grp and prj - involved in a
298 * transaction is 3 so we don't need to make this very generic.
301 xfs_trans_dqlockedjoin(
305 ASSERT(q[0].qt_dquot != NULL);
306 if (q[1].qt_dquot == NULL) {
307 xfs_dqlock(q[0].qt_dquot);
308 xfs_trans_dqjoin(tp, q[0].qt_dquot);
310 ASSERT(XFS_QM_TRANS_MAXDQS == 2);
311 xfs_dqlock2(q[0].qt_dquot, q[1].qt_dquot);
312 xfs_trans_dqjoin(tp, q[0].qt_dquot);
313 xfs_trans_dqjoin(tp, q[1].qt_dquot);
319 * Called by xfs_trans_commit() and similar in spirit to
320 * xfs_trans_apply_sb_deltas().
321 * Go thru all the dquots belonging to this transaction and modify the
322 * INCORE dquot to reflect the actual usages.
323 * Unreserve just the reservations done by this transaction.
324 * dquot is still left locked at exit.
327 xfs_trans_apply_dquot_deltas(
328 struct xfs_trans *tp)
331 struct xfs_dquot *dqp;
332 struct xfs_dqtrx *qtrx, *qa;
333 struct xfs_disk_dquot *d;
337 if (!(tp->t_flags & XFS_TRANS_DQ_DIRTY))
340 ASSERT(tp->t_dqinfo);
341 for (j = 0; j < XFS_QM_TRANS_DQTYPES; j++) {
342 qa = tp->t_dqinfo->dqs[j];
343 if (qa[0].qt_dquot == NULL)
347 * Lock all of the dquots and join them to the transaction.
349 xfs_trans_dqlockedjoin(tp, qa);
351 for (i = 0; i < XFS_QM_TRANS_MAXDQS; i++) {
354 * The array of dquots is filled
355 * sequentially, not sparsely.
357 if ((dqp = qtrx->qt_dquot) == NULL)
360 ASSERT(XFS_DQ_IS_LOCKED(dqp));
361 ASSERT(dqp->q_transp == tp);
364 * adjust the actual number of blocks used
369 * The issue here is - sometimes we don't make a blkquota
370 * reservation intentionally to be fair to users
371 * (when the amount is small). On the other hand,
372 * delayed allocs do make reservations, but that's
373 * outside of a transaction, so we have no
374 * idea how much was really reserved.
375 * So, here we've accumulated delayed allocation blks and
376 * non-delay blks. The assumption is that the
377 * delayed ones are always reserved (outside of a
378 * transaction), and the others may or may not have
379 * quota reservations.
381 totalbdelta = qtrx->qt_bcount_delta +
382 qtrx->qt_delbcnt_delta;
383 totalrtbdelta = qtrx->qt_rtbcount_delta +
384 qtrx->qt_delrtb_delta;
387 ASSERT(be64_to_cpu(d->d_bcount) >=
390 if (totalrtbdelta < 0)
391 ASSERT(be64_to_cpu(d->d_rtbcount) >=
394 if (qtrx->qt_icount_delta < 0)
395 ASSERT(be64_to_cpu(d->d_icount) >=
396 -qtrx->qt_icount_delta);
399 be64_add_cpu(&d->d_bcount, (xfs_qcnt_t)totalbdelta);
401 if (qtrx->qt_icount_delta)
402 be64_add_cpu(&d->d_icount, (xfs_qcnt_t)qtrx->qt_icount_delta);
405 be64_add_cpu(&d->d_rtbcount, (xfs_qcnt_t)totalrtbdelta);
408 * Get any default limits in use.
409 * Start/reset the timer(s) if needed.
412 xfs_qm_adjust_dqlimits(tp->t_mountp, dqp);
413 xfs_qm_adjust_dqtimers(tp->t_mountp, d);
416 dqp->dq_flags |= XFS_DQ_DIRTY;
418 * add this to the list of items to get logged
420 xfs_trans_log_dquot(tp, dqp);
422 * Take off what's left of the original reservation.
423 * In case of delayed allocations, there's no
424 * reservation that a transaction structure knows of.
426 if (qtrx->qt_blk_res != 0) {
427 if (qtrx->qt_blk_res != qtrx->qt_blk_res_used) {
428 if (qtrx->qt_blk_res >
429 qtrx->qt_blk_res_used)
430 dqp->q_res_bcount -= (xfs_qcnt_t)
432 qtrx->qt_blk_res_used);
434 dqp->q_res_bcount -= (xfs_qcnt_t)
435 (qtrx->qt_blk_res_used -
440 * These blks were never reserved, either inside
441 * a transaction or outside one (in a delayed
442 * allocation). Also, this isn't always a
443 * negative number since we sometimes
444 * deliberately skip quota reservations.
446 if (qtrx->qt_bcount_delta) {
448 (xfs_qcnt_t)qtrx->qt_bcount_delta;
452 * Adjust the RT reservation.
454 if (qtrx->qt_rtblk_res != 0) {
455 if (qtrx->qt_rtblk_res != qtrx->qt_rtblk_res_used) {
456 if (qtrx->qt_rtblk_res >
457 qtrx->qt_rtblk_res_used)
458 dqp->q_res_rtbcount -= (xfs_qcnt_t)
459 (qtrx->qt_rtblk_res -
460 qtrx->qt_rtblk_res_used);
462 dqp->q_res_rtbcount -= (xfs_qcnt_t)
463 (qtrx->qt_rtblk_res_used -
467 if (qtrx->qt_rtbcount_delta)
468 dqp->q_res_rtbcount +=
469 (xfs_qcnt_t)qtrx->qt_rtbcount_delta;
473 * Adjust the inode reservation.
475 if (qtrx->qt_ino_res != 0) {
476 ASSERT(qtrx->qt_ino_res >=
477 qtrx->qt_ino_res_used);
478 if (qtrx->qt_ino_res > qtrx->qt_ino_res_used)
479 dqp->q_res_icount -= (xfs_qcnt_t)
481 qtrx->qt_ino_res_used);
483 if (qtrx->qt_icount_delta)
485 (xfs_qcnt_t)qtrx->qt_icount_delta;
488 ASSERT(dqp->q_res_bcount >=
489 be64_to_cpu(dqp->q_core.d_bcount));
490 ASSERT(dqp->q_res_icount >=
491 be64_to_cpu(dqp->q_core.d_icount));
492 ASSERT(dqp->q_res_rtbcount >=
493 be64_to_cpu(dqp->q_core.d_rtbcount));
499 * Release the reservations, and adjust the dquots accordingly.
500 * This is called only when the transaction is being aborted. If by
501 * any chance we have done dquot modifications incore (ie. deltas) already,
502 * we simply throw those away, since that's the expected behavior
503 * when a transaction is curtailed without a commit.
506 xfs_trans_unreserve_and_mod_dquots(
511 xfs_dqtrx_t *qtrx, *qa;
514 if (!tp->t_dqinfo || !(tp->t_flags & XFS_TRANS_DQ_DIRTY))
517 for (j = 0; j < XFS_QM_TRANS_DQTYPES; j++) {
518 qa = tp->t_dqinfo->dqs[j];
520 for (i = 0; i < XFS_QM_TRANS_MAXDQS; i++) {
523 * We assume that the array of dquots is filled
524 * sequentially, not sparsely.
526 if ((dqp = qtrx->qt_dquot) == NULL)
529 * Unreserve the original reservation. We don't care
530 * about the number of blocks used field, or deltas.
531 * Also we don't bother to zero the fields.
534 if (qtrx->qt_blk_res) {
538 (xfs_qcnt_t)qtrx->qt_blk_res;
540 if (qtrx->qt_ino_res) {
546 (xfs_qcnt_t)qtrx->qt_ino_res;
549 if (qtrx->qt_rtblk_res) {
554 dqp->q_res_rtbcount -=
555 (xfs_qcnt_t)qtrx->qt_rtblk_res;
566 struct xfs_mount *mp,
567 struct xfs_dquot *dqp,
570 /* no warnings for project quotas - we just return ENOSPC later */
571 if (dqp->dq_flags & XFS_DQ_PROJ)
573 quota_send_warning(make_kqid(&init_user_ns,
574 (dqp->dq_flags & XFS_DQ_USER) ?
576 be32_to_cpu(dqp->q_core.d_id)),
577 mp->m_super->s_dev, type);
581 * This reserves disk blocks and inodes against a dquot.
582 * Flags indicate if the dquot is to be locked here and also
583 * if the blk reservation is for RT or regular blocks.
584 * Sending in XFS_QMOPT_FORCE_RES flag skips the quota check.
595 xfs_qcnt_t hardlimit;
596 xfs_qcnt_t softlimit;
598 xfs_qwarncnt_t warns;
599 xfs_qwarncnt_t warnlimit;
600 xfs_qcnt_t total_count;
601 xfs_qcnt_t *resbcountp;
602 xfs_quotainfo_t *q = mp->m_quotainfo;
607 if (flags & XFS_TRANS_DQ_RES_BLKS) {
608 hardlimit = be64_to_cpu(dqp->q_core.d_blk_hardlimit);
610 hardlimit = q->qi_bhardlimit;
611 softlimit = be64_to_cpu(dqp->q_core.d_blk_softlimit);
613 softlimit = q->qi_bsoftlimit;
614 timer = be32_to_cpu(dqp->q_core.d_btimer);
615 warns = be16_to_cpu(dqp->q_core.d_bwarns);
616 warnlimit = dqp->q_mount->m_quotainfo->qi_bwarnlimit;
617 resbcountp = &dqp->q_res_bcount;
619 ASSERT(flags & XFS_TRANS_DQ_RES_RTBLKS);
620 hardlimit = be64_to_cpu(dqp->q_core.d_rtb_hardlimit);
622 hardlimit = q->qi_rtbhardlimit;
623 softlimit = be64_to_cpu(dqp->q_core.d_rtb_softlimit);
625 softlimit = q->qi_rtbsoftlimit;
626 timer = be32_to_cpu(dqp->q_core.d_rtbtimer);
627 warns = be16_to_cpu(dqp->q_core.d_rtbwarns);
628 warnlimit = dqp->q_mount->m_quotainfo->qi_rtbwarnlimit;
629 resbcountp = &dqp->q_res_rtbcount;
632 if ((flags & XFS_QMOPT_FORCE_RES) == 0 &&
634 ((XFS_IS_UQUOTA_ENFORCED(dqp->q_mount) && XFS_QM_ISUDQ(dqp)) ||
635 (XFS_IS_GQUOTA_ENFORCED(dqp->q_mount) && XFS_QM_ISGDQ(dqp)) ||
636 (XFS_IS_PQUOTA_ENFORCED(dqp->q_mount) && XFS_QM_ISPDQ(dqp)))) {
639 * dquot is locked already. See if we'd go over the
640 * hardlimit or exceed the timelimit if we allocate
643 total_count = *resbcountp + nblks;
644 if (hardlimit && total_count > hardlimit) {
645 xfs_quota_warn(mp, dqp, QUOTA_NL_BHARDWARN);
648 if (softlimit && total_count > softlimit) {
649 if ((timer != 0 && get_seconds() > timer) ||
650 (warns != 0 && warns >= warnlimit)) {
651 xfs_quota_warn(mp, dqp,
652 QUOTA_NL_BSOFTLONGWARN);
656 xfs_quota_warn(mp, dqp, QUOTA_NL_BSOFTWARN);
660 total_count = be64_to_cpu(dqp->q_core.d_icount) + ninos;
661 timer = be32_to_cpu(dqp->q_core.d_itimer);
662 warns = be16_to_cpu(dqp->q_core.d_iwarns);
663 warnlimit = dqp->q_mount->m_quotainfo->qi_iwarnlimit;
664 hardlimit = be64_to_cpu(dqp->q_core.d_ino_hardlimit);
666 hardlimit = q->qi_ihardlimit;
667 softlimit = be64_to_cpu(dqp->q_core.d_ino_softlimit);
669 softlimit = q->qi_isoftlimit;
671 if (hardlimit && total_count > hardlimit) {
672 xfs_quota_warn(mp, dqp, QUOTA_NL_IHARDWARN);
675 if (softlimit && total_count > softlimit) {
676 if ((timer != 0 && get_seconds() > timer) ||
677 (warns != 0 && warns >= warnlimit)) {
678 xfs_quota_warn(mp, dqp,
679 QUOTA_NL_ISOFTLONGWARN);
682 xfs_quota_warn(mp, dqp, QUOTA_NL_ISOFTWARN);
688 * Change the reservation, but not the actual usage.
689 * Note that q_res_bcount = q_core.d_bcount + resv
691 (*resbcountp) += (xfs_qcnt_t)nblks;
693 dqp->q_res_icount += (xfs_qcnt_t)ninos;
696 * note the reservation amt in the trans struct too,
697 * so that the transaction knows how much was reserved by
698 * it against this particular dquot.
699 * We don't do this when we are reserving for a delayed allocation,
700 * because we don't have the luxury of a transaction envelope then.
703 ASSERT(tp->t_dqinfo);
704 ASSERT(flags & XFS_QMOPT_RESBLK_MASK);
706 xfs_trans_mod_dquot(tp, dqp,
707 flags & XFS_QMOPT_RESBLK_MASK,
710 xfs_trans_mod_dquot(tp, dqp,
711 XFS_TRANS_DQ_RES_INOS,
714 ASSERT(dqp->q_res_bcount >= be64_to_cpu(dqp->q_core.d_bcount));
715 ASSERT(dqp->q_res_rtbcount >= be64_to_cpu(dqp->q_core.d_rtbcount));
716 ASSERT(dqp->q_res_icount >= be64_to_cpu(dqp->q_core.d_icount));
723 if (flags & XFS_QMOPT_ENOSPC)
730 * Given dquot(s), make disk block and/or inode reservations against them.
731 * The fact that this does the reservation against user, group and
732 * project quotas is important, because this follows a all-or-nothing
735 * flags = XFS_QMOPT_FORCE_RES evades limit enforcement. Used by chown.
736 * XFS_QMOPT_ENOSPC returns ENOSPC not EDQUOT. Used by pquota.
737 * XFS_TRANS_DQ_RES_BLKS reserves regular disk blocks
738 * XFS_TRANS_DQ_RES_RTBLKS reserves realtime disk blocks
739 * dquots are unlocked on return, if they were not locked by caller.
742 xfs_trans_reserve_quota_bydquots(
743 struct xfs_trans *tp,
744 struct xfs_mount *mp,
745 struct xfs_dquot *udqp,
746 struct xfs_dquot *gdqp,
747 struct xfs_dquot *pdqp,
754 if (!XFS_IS_QUOTA_RUNNING(mp) || !XFS_IS_QUOTA_ON(mp))
757 if (tp && tp->t_dqinfo == NULL)
758 xfs_trans_alloc_dqinfo(tp);
760 ASSERT(flags & XFS_QMOPT_RESBLK_MASK);
763 error = xfs_trans_dqresv(tp, mp, udqp, nblks, ninos,
764 (flags & ~XFS_QMOPT_ENOSPC));
770 error = xfs_trans_dqresv(tp, mp, gdqp, nblks, ninos, flags);
776 error = xfs_trans_dqresv(tp, mp, pdqp, nblks, ninos, flags);
782 * Didn't change anything critical, so, no need to log
787 flags |= XFS_QMOPT_FORCE_RES;
789 xfs_trans_dqresv(tp, mp, gdqp, -nblks, -ninos, flags);
791 flags |= XFS_QMOPT_FORCE_RES;
793 xfs_trans_dqresv(tp, mp, udqp, -nblks, -ninos, flags);
799 * Lock the dquot and change the reservation if we can.
800 * This doesn't change the actual usage, just the reservation.
801 * The inode sent in is locked.
804 xfs_trans_reserve_quota_nblks(
805 struct xfs_trans *tp,
806 struct xfs_inode *ip,
811 struct xfs_mount *mp = ip->i_mount;
813 if (!XFS_IS_QUOTA_RUNNING(mp) || !XFS_IS_QUOTA_ON(mp))
815 if (XFS_IS_PQUOTA_ON(mp))
816 flags |= XFS_QMOPT_ENOSPC;
818 ASSERT(!xfs_is_quota_inode(&mp->m_sb, ip->i_ino));
820 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
821 ASSERT((flags & ~(XFS_QMOPT_FORCE_RES | XFS_QMOPT_ENOSPC)) ==
822 XFS_TRANS_DQ_RES_RTBLKS ||
823 (flags & ~(XFS_QMOPT_FORCE_RES | XFS_QMOPT_ENOSPC)) ==
824 XFS_TRANS_DQ_RES_BLKS);
827 * Reserve nblks against these dquots, with trans as the mediator.
829 return xfs_trans_reserve_quota_bydquots(tp, mp,
830 ip->i_udquot, ip->i_gdquot,
832 nblks, ninos, flags);
836 * This routine is called to allocate a quotaoff log item.
839 xfs_trans_get_qoff_item(
841 xfs_qoff_logitem_t *startqoff,
844 xfs_qoff_logitem_t *q;
848 q = xfs_qm_qoff_logitem_init(tp->t_mountp, startqoff, flags);
852 * Get a log_item_desc to point at the new item.
854 xfs_trans_add_item(tp, &q->qql_item);
860 * This is called to mark the quotaoff logitem as needing
861 * to be logged when the transaction is committed. The logitem must
862 * already be associated with the given transaction.
865 xfs_trans_log_quotaoff_item(
867 xfs_qoff_logitem_t *qlp)
869 tp->t_flags |= XFS_TRANS_DIRTY;
870 qlp->qql_item.li_desc->lid_flags |= XFS_LID_DIRTY;
874 xfs_trans_alloc_dqinfo(
877 tp->t_dqinfo = kmem_zone_zalloc(xfs_qm_dqtrxzone, KM_SLEEP);
881 xfs_trans_free_dqinfo(
886 kmem_zone_free(xfs_qm_dqtrxzone, tp->t_dqinfo);