1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2000-2002 Silicon Graphics, Inc.
8 #include "xfs_shared.h"
9 #include "xfs_format.h"
10 #include "xfs_log_format.h"
11 #include "xfs_trans_resv.h"
12 #include "xfs_mount.h"
13 #include "xfs_inode.h"
14 #include "xfs_trans.h"
15 #include "xfs_trans_priv.h"
16 #include "xfs_quota.h"
18 #include "xfs_error.h"
20 STATIC void xfs_trans_alloc_dqinfo(xfs_trans_t *);
23 * Add the locked dquot to the transaction.
24 * The dquot must be locked, and it cannot be associated with any
30 struct xfs_dquot *dqp)
32 ASSERT(XFS_DQ_IS_LOCKED(dqp));
33 ASSERT(dqp->q_logitem.qli_dquot == dqp);
36 * Get a log_item_desc to point at the new item.
38 xfs_trans_add_item(tp, &dqp->q_logitem.qli_item);
42 * This is called to mark the dquot as needing
43 * to be logged when the transaction is committed. The dquot must
44 * already be associated with the given transaction.
45 * Note that it marks the entire transaction as dirty. In the ordinary
46 * case, this gets called via xfs_trans_commit, after the transaction
47 * is already dirty. However, there's nothing stop this from getting
48 * called directly, as done by xfs_qm_scall_setqlim. Hence, the TRANS_DIRTY
54 struct xfs_dquot *dqp)
56 ASSERT(XFS_DQ_IS_LOCKED(dqp));
58 tp->t_flags |= XFS_TRANS_DIRTY;
59 set_bit(XFS_LI_DIRTY, &dqp->q_logitem.qli_item.li_flags);
63 * Carry forward whatever is left of the quota blk reservation to
64 * the spanky new transaction
68 struct xfs_trans *otp,
69 struct xfs_trans *ntp)
71 struct xfs_dqtrx *oq, *nq;
73 struct xfs_dqtrx *oqa, *nqa;
74 uint64_t blk_res_used;
79 xfs_trans_alloc_dqinfo(ntp);
82 * Because the quota blk reservation is carried forward,
83 * it is also necessary to carry forward the DQ_DIRTY flag.
85 if (otp->t_flags & XFS_TRANS_DQ_DIRTY)
86 ntp->t_flags |= XFS_TRANS_DQ_DIRTY;
88 for (j = 0; j < XFS_QM_TRANS_DQTYPES; j++) {
89 oqa = otp->t_dqinfo->dqs[j];
90 nqa = ntp->t_dqinfo->dqs[j];
91 for (i = 0; i < XFS_QM_TRANS_MAXDQS; i++) {
94 if (oqa[i].qt_dquot == NULL)
99 if (oq->qt_blk_res && oq->qt_bcount_delta > 0)
100 blk_res_used = oq->qt_bcount_delta;
102 nq->qt_dquot = oq->qt_dquot;
103 nq->qt_bcount_delta = nq->qt_icount_delta = 0;
104 nq->qt_rtbcount_delta = 0;
107 * Transfer whatever is left of the reservations.
109 nq->qt_blk_res = oq->qt_blk_res - blk_res_used;
110 oq->qt_blk_res = blk_res_used;
112 nq->qt_rtblk_res = oq->qt_rtblk_res -
113 oq->qt_rtblk_res_used;
114 oq->qt_rtblk_res = oq->qt_rtblk_res_used;
116 nq->qt_ino_res = oq->qt_ino_res - oq->qt_ino_res_used;
117 oq->qt_ino_res = oq->qt_ino_res_used;
124 * Wrap around mod_dquot to account for both user and group quotas.
127 xfs_trans_mod_dquot_byino(
133 xfs_mount_t *mp = tp->t_mountp;
135 if (!XFS_IS_QUOTA_RUNNING(mp) ||
136 !XFS_IS_QUOTA_ON(mp) ||
137 xfs_is_quota_inode(&mp->m_sb, ip->i_ino))
140 if (tp->t_dqinfo == NULL)
141 xfs_trans_alloc_dqinfo(tp);
143 if (XFS_IS_UQUOTA_ON(mp) && ip->i_udquot)
144 (void) xfs_trans_mod_dquot(tp, ip->i_udquot, field, delta);
145 if (XFS_IS_GQUOTA_ON(mp) && ip->i_gdquot)
146 (void) xfs_trans_mod_dquot(tp, ip->i_gdquot, field, delta);
147 if (XFS_IS_PQUOTA_ON(mp) && ip->i_pdquot)
148 (void) xfs_trans_mod_dquot(tp, ip->i_pdquot, field, delta);
151 STATIC struct xfs_dqtrx *
153 struct xfs_trans *tp,
154 struct xfs_dquot *dqp)
157 struct xfs_dqtrx *qa;
159 if (XFS_QM_ISUDQ(dqp))
160 qa = tp->t_dqinfo->dqs[XFS_QM_TRANS_USR];
161 else if (XFS_QM_ISGDQ(dqp))
162 qa = tp->t_dqinfo->dqs[XFS_QM_TRANS_GRP];
163 else if (XFS_QM_ISPDQ(dqp))
164 qa = tp->t_dqinfo->dqs[XFS_QM_TRANS_PRJ];
168 for (i = 0; i < XFS_QM_TRANS_MAXDQS; i++) {
169 if (qa[i].qt_dquot == NULL ||
170 qa[i].qt_dquot == dqp)
178 * Make the changes in the transaction structure.
179 * The moral equivalent to xfs_trans_mod_sb().
180 * We don't touch any fields in the dquot, so we don't care
181 * if it's locked or not (most of the time it won't be).
185 struct xfs_trans *tp,
186 struct xfs_dquot *dqp,
190 struct xfs_dqtrx *qtrx;
193 ASSERT(XFS_IS_QUOTA_RUNNING(tp->t_mountp));
196 if (tp->t_dqinfo == NULL)
197 xfs_trans_alloc_dqinfo(tp);
199 * Find either the first free slot or the slot that belongs
202 qtrx = xfs_trans_get_dqtrx(tp, dqp);
204 if (qtrx->qt_dquot == NULL)
205 qtrx->qt_dquot = dqp;
210 * regular disk blk reservation
212 case XFS_TRANS_DQ_RES_BLKS:
213 qtrx->qt_blk_res += delta;
219 case XFS_TRANS_DQ_RES_INOS:
220 qtrx->qt_ino_res += delta;
226 case XFS_TRANS_DQ_BCOUNT:
227 qtrx->qt_bcount_delta += delta;
230 case XFS_TRANS_DQ_DELBCOUNT:
231 qtrx->qt_delbcnt_delta += delta;
237 case XFS_TRANS_DQ_ICOUNT:
238 if (qtrx->qt_ino_res && delta > 0) {
239 qtrx->qt_ino_res_used += delta;
240 ASSERT(qtrx->qt_ino_res >= qtrx->qt_ino_res_used);
242 qtrx->qt_icount_delta += delta;
248 case XFS_TRANS_DQ_RES_RTBLKS:
249 qtrx->qt_rtblk_res += delta;
255 case XFS_TRANS_DQ_RTBCOUNT:
256 if (qtrx->qt_rtblk_res && delta > 0) {
257 qtrx->qt_rtblk_res_used += delta;
258 ASSERT(qtrx->qt_rtblk_res >= qtrx->qt_rtblk_res_used);
260 qtrx->qt_rtbcount_delta += delta;
263 case XFS_TRANS_DQ_DELRTBCOUNT:
264 qtrx->qt_delrtb_delta += delta;
270 tp->t_flags |= XFS_TRANS_DQ_DIRTY;
275 * Given an array of dqtrx structures, lock all the dquots associated and join
276 * them to the transaction, provided they have been modified. We know that the
277 * highest number of dquots of one type - usr, grp and prj - involved in a
278 * transaction is 3 so we don't need to make this very generic.
281 xfs_trans_dqlockedjoin(
282 struct xfs_trans *tp,
285 ASSERT(q[0].qt_dquot != NULL);
286 if (q[1].qt_dquot == NULL) {
287 xfs_dqlock(q[0].qt_dquot);
288 xfs_trans_dqjoin(tp, q[0].qt_dquot);
290 ASSERT(XFS_QM_TRANS_MAXDQS == 2);
291 xfs_dqlock2(q[0].qt_dquot, q[1].qt_dquot);
292 xfs_trans_dqjoin(tp, q[0].qt_dquot);
293 xfs_trans_dqjoin(tp, q[1].qt_dquot);
299 * Called by xfs_trans_commit() and similar in spirit to
300 * xfs_trans_apply_sb_deltas().
301 * Go thru all the dquots belonging to this transaction and modify the
302 * INCORE dquot to reflect the actual usages.
303 * Unreserve just the reservations done by this transaction.
304 * dquot is still left locked at exit.
307 xfs_trans_apply_dquot_deltas(
308 struct xfs_trans *tp)
311 struct xfs_dquot *dqp;
312 struct xfs_dqtrx *qtrx, *qa;
313 struct xfs_disk_dquot *d;
315 int64_t totalrtbdelta;
317 if (!(tp->t_flags & XFS_TRANS_DQ_DIRTY))
320 ASSERT(tp->t_dqinfo);
321 for (j = 0; j < XFS_QM_TRANS_DQTYPES; j++) {
322 qa = tp->t_dqinfo->dqs[j];
323 if (qa[0].qt_dquot == NULL)
327 * Lock all of the dquots and join them to the transaction.
329 xfs_trans_dqlockedjoin(tp, qa);
331 for (i = 0; i < XFS_QM_TRANS_MAXDQS; i++) {
334 * The array of dquots is filled
335 * sequentially, not sparsely.
337 if ((dqp = qtrx->qt_dquot) == NULL)
340 ASSERT(XFS_DQ_IS_LOCKED(dqp));
343 * adjust the actual number of blocks used
348 * The issue here is - sometimes we don't make a blkquota
349 * reservation intentionally to be fair to users
350 * (when the amount is small). On the other hand,
351 * delayed allocs do make reservations, but that's
352 * outside of a transaction, so we have no
353 * idea how much was really reserved.
354 * So, here we've accumulated delayed allocation blks and
355 * non-delay blks. The assumption is that the
356 * delayed ones are always reserved (outside of a
357 * transaction), and the others may or may not have
358 * quota reservations.
360 totalbdelta = qtrx->qt_bcount_delta +
361 qtrx->qt_delbcnt_delta;
362 totalrtbdelta = qtrx->qt_rtbcount_delta +
363 qtrx->qt_delrtb_delta;
366 ASSERT(be64_to_cpu(d->d_bcount) >=
369 if (totalrtbdelta < 0)
370 ASSERT(be64_to_cpu(d->d_rtbcount) >=
373 if (qtrx->qt_icount_delta < 0)
374 ASSERT(be64_to_cpu(d->d_icount) >=
375 -qtrx->qt_icount_delta);
378 be64_add_cpu(&d->d_bcount, (xfs_qcnt_t)totalbdelta);
380 if (qtrx->qt_icount_delta)
381 be64_add_cpu(&d->d_icount, (xfs_qcnt_t)qtrx->qt_icount_delta);
384 be64_add_cpu(&d->d_rtbcount, (xfs_qcnt_t)totalrtbdelta);
387 * Get any default limits in use.
388 * Start/reset the timer(s) if needed.
391 xfs_qm_adjust_dqlimits(tp->t_mountp, dqp);
392 xfs_qm_adjust_dqtimers(tp->t_mountp, d);
395 dqp->dq_flags |= XFS_DQ_DIRTY;
397 * add this to the list of items to get logged
399 xfs_trans_log_dquot(tp, dqp);
401 * Take off what's left of the original reservation.
402 * In case of delayed allocations, there's no
403 * reservation that a transaction structure knows of.
405 if (qtrx->qt_blk_res != 0) {
406 uint64_t blk_res_used = 0;
408 if (qtrx->qt_bcount_delta > 0)
409 blk_res_used = qtrx->qt_bcount_delta;
411 if (qtrx->qt_blk_res != blk_res_used) {
412 if (qtrx->qt_blk_res > blk_res_used)
413 dqp->q_res_bcount -= (xfs_qcnt_t)
417 dqp->q_res_bcount -= (xfs_qcnt_t)
423 * These blks were never reserved, either inside
424 * a transaction or outside one (in a delayed
425 * allocation). Also, this isn't always a
426 * negative number since we sometimes
427 * deliberately skip quota reservations.
429 if (qtrx->qt_bcount_delta) {
431 (xfs_qcnt_t)qtrx->qt_bcount_delta;
435 * Adjust the RT reservation.
437 if (qtrx->qt_rtblk_res != 0) {
438 if (qtrx->qt_rtblk_res != qtrx->qt_rtblk_res_used) {
439 if (qtrx->qt_rtblk_res >
440 qtrx->qt_rtblk_res_used)
441 dqp->q_res_rtbcount -= (xfs_qcnt_t)
442 (qtrx->qt_rtblk_res -
443 qtrx->qt_rtblk_res_used);
445 dqp->q_res_rtbcount -= (xfs_qcnt_t)
446 (qtrx->qt_rtblk_res_used -
450 if (qtrx->qt_rtbcount_delta)
451 dqp->q_res_rtbcount +=
452 (xfs_qcnt_t)qtrx->qt_rtbcount_delta;
456 * Adjust the inode reservation.
458 if (qtrx->qt_ino_res != 0) {
459 ASSERT(qtrx->qt_ino_res >=
460 qtrx->qt_ino_res_used);
461 if (qtrx->qt_ino_res > qtrx->qt_ino_res_used)
462 dqp->q_res_icount -= (xfs_qcnt_t)
464 qtrx->qt_ino_res_used);
466 if (qtrx->qt_icount_delta)
468 (xfs_qcnt_t)qtrx->qt_icount_delta;
471 ASSERT(dqp->q_res_bcount >=
472 be64_to_cpu(dqp->q_core.d_bcount));
473 ASSERT(dqp->q_res_icount >=
474 be64_to_cpu(dqp->q_core.d_icount));
475 ASSERT(dqp->q_res_rtbcount >=
476 be64_to_cpu(dqp->q_core.d_rtbcount));
482 * Release the reservations, and adjust the dquots accordingly.
483 * This is called only when the transaction is being aborted. If by
484 * any chance we have done dquot modifications incore (ie. deltas) already,
485 * we simply throw those away, since that's the expected behavior
486 * when a transaction is curtailed without a commit.
489 xfs_trans_unreserve_and_mod_dquots(
490 struct xfs_trans *tp)
493 struct xfs_dquot *dqp;
494 struct xfs_dqtrx *qtrx, *qa;
497 if (!tp->t_dqinfo || !(tp->t_flags & XFS_TRANS_DQ_DIRTY))
500 for (j = 0; j < XFS_QM_TRANS_DQTYPES; j++) {
501 qa = tp->t_dqinfo->dqs[j];
503 for (i = 0; i < XFS_QM_TRANS_MAXDQS; i++) {
506 * We assume that the array of dquots is filled
507 * sequentially, not sparsely.
509 if ((dqp = qtrx->qt_dquot) == NULL)
512 * Unreserve the original reservation. We don't care
513 * about the number of blocks used field, or deltas.
514 * Also we don't bother to zero the fields.
517 if (qtrx->qt_blk_res) {
521 (xfs_qcnt_t)qtrx->qt_blk_res;
523 if (qtrx->qt_ino_res) {
529 (xfs_qcnt_t)qtrx->qt_ino_res;
532 if (qtrx->qt_rtblk_res) {
537 dqp->q_res_rtbcount -=
538 (xfs_qcnt_t)qtrx->qt_rtblk_res;
549 struct xfs_mount *mp,
550 struct xfs_dquot *dqp,
553 enum quota_type qtype;
555 if (dqp->dq_flags & XFS_DQ_PROJ)
557 else if (dqp->dq_flags & XFS_DQ_USER)
562 quota_send_warning(make_kqid(&init_user_ns, qtype,
563 be32_to_cpu(dqp->q_core.d_id)),
564 mp->m_super->s_dev, type);
568 * This reserves disk blocks and inodes against a dquot.
569 * Flags indicate if the dquot is to be locked here and also
570 * if the blk reservation is for RT or regular blocks.
571 * Sending in XFS_QMOPT_FORCE_RES flag skips the quota check.
575 struct xfs_trans *tp,
576 struct xfs_mount *mp,
577 struct xfs_dquot *dqp,
582 xfs_qcnt_t hardlimit;
583 xfs_qcnt_t softlimit;
585 xfs_qwarncnt_t warns;
586 xfs_qwarncnt_t warnlimit;
587 xfs_qcnt_t total_count;
588 xfs_qcnt_t *resbcountp;
589 xfs_quotainfo_t *q = mp->m_quotainfo;
590 struct xfs_def_quota *defq;
595 defq = xfs_get_defquota(dqp, q);
597 if (flags & XFS_TRANS_DQ_RES_BLKS) {
598 hardlimit = be64_to_cpu(dqp->q_core.d_blk_hardlimit);
600 hardlimit = defq->bhardlimit;
601 softlimit = be64_to_cpu(dqp->q_core.d_blk_softlimit);
603 softlimit = defq->bsoftlimit;
604 timer = be32_to_cpu(dqp->q_core.d_btimer);
605 warns = be16_to_cpu(dqp->q_core.d_bwarns);
606 warnlimit = dqp->q_mount->m_quotainfo->qi_bwarnlimit;
607 resbcountp = &dqp->q_res_bcount;
609 ASSERT(flags & XFS_TRANS_DQ_RES_RTBLKS);
610 hardlimit = be64_to_cpu(dqp->q_core.d_rtb_hardlimit);
612 hardlimit = defq->rtbhardlimit;
613 softlimit = be64_to_cpu(dqp->q_core.d_rtb_softlimit);
615 softlimit = defq->rtbsoftlimit;
616 timer = be32_to_cpu(dqp->q_core.d_rtbtimer);
617 warns = be16_to_cpu(dqp->q_core.d_rtbwarns);
618 warnlimit = dqp->q_mount->m_quotainfo->qi_rtbwarnlimit;
619 resbcountp = &dqp->q_res_rtbcount;
622 if ((flags & XFS_QMOPT_FORCE_RES) == 0 &&
624 ((XFS_IS_UQUOTA_ENFORCED(dqp->q_mount) && XFS_QM_ISUDQ(dqp)) ||
625 (XFS_IS_GQUOTA_ENFORCED(dqp->q_mount) && XFS_QM_ISGDQ(dqp)) ||
626 (XFS_IS_PQUOTA_ENFORCED(dqp->q_mount) && XFS_QM_ISPDQ(dqp)))) {
629 * dquot is locked already. See if we'd go over the
630 * hardlimit or exceed the timelimit if we allocate
633 total_count = *resbcountp + nblks;
634 if (hardlimit && total_count > hardlimit) {
635 xfs_quota_warn(mp, dqp, QUOTA_NL_BHARDWARN);
638 if (softlimit && total_count > softlimit) {
639 if ((timer != 0 && get_seconds() > timer) ||
640 (warns != 0 && warns >= warnlimit)) {
641 xfs_quota_warn(mp, dqp,
642 QUOTA_NL_BSOFTLONGWARN);
646 xfs_quota_warn(mp, dqp, QUOTA_NL_BSOFTWARN);
650 total_count = dqp->q_res_icount + ninos;
651 timer = be32_to_cpu(dqp->q_core.d_itimer);
652 warns = be16_to_cpu(dqp->q_core.d_iwarns);
653 warnlimit = dqp->q_mount->m_quotainfo->qi_iwarnlimit;
654 hardlimit = be64_to_cpu(dqp->q_core.d_ino_hardlimit);
656 hardlimit = defq->ihardlimit;
657 softlimit = be64_to_cpu(dqp->q_core.d_ino_softlimit);
659 softlimit = defq->isoftlimit;
661 if (hardlimit && total_count > hardlimit) {
662 xfs_quota_warn(mp, dqp, QUOTA_NL_IHARDWARN);
665 if (softlimit && total_count > softlimit) {
666 if ((timer != 0 && get_seconds() > timer) ||
667 (warns != 0 && warns >= warnlimit)) {
668 xfs_quota_warn(mp, dqp,
669 QUOTA_NL_ISOFTLONGWARN);
672 xfs_quota_warn(mp, dqp, QUOTA_NL_ISOFTWARN);
678 * Change the reservation, but not the actual usage.
679 * Note that q_res_bcount = q_core.d_bcount + resv
681 (*resbcountp) += (xfs_qcnt_t)nblks;
683 dqp->q_res_icount += (xfs_qcnt_t)ninos;
686 * note the reservation amt in the trans struct too,
687 * so that the transaction knows how much was reserved by
688 * it against this particular dquot.
689 * We don't do this when we are reserving for a delayed allocation,
690 * because we don't have the luxury of a transaction envelope then.
693 ASSERT(tp->t_dqinfo);
694 ASSERT(flags & XFS_QMOPT_RESBLK_MASK);
696 xfs_trans_mod_dquot(tp, dqp,
697 flags & XFS_QMOPT_RESBLK_MASK,
700 xfs_trans_mod_dquot(tp, dqp,
701 XFS_TRANS_DQ_RES_INOS,
705 if (XFS_IS_CORRUPT(mp,
706 dqp->q_res_bcount < be64_to_cpu(dqp->q_core.d_bcount)) ||
708 dqp->q_res_rtbcount < be64_to_cpu(dqp->q_core.d_rtbcount)) ||
710 dqp->q_res_icount < be64_to_cpu(dqp->q_core.d_icount)))
718 if (flags & XFS_QMOPT_ENOSPC)
723 xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
724 return -EFSCORRUPTED;
729 * Given dquot(s), make disk block and/or inode reservations against them.
730 * The fact that this does the reservation against user, group and
731 * project quotas is important, because this follows a all-or-nothing
734 * flags = XFS_QMOPT_FORCE_RES evades limit enforcement. Used by chown.
735 * XFS_QMOPT_ENOSPC returns ENOSPC not EDQUOT. Used by pquota.
736 * XFS_TRANS_DQ_RES_BLKS reserves regular disk blocks
737 * XFS_TRANS_DQ_RES_RTBLKS reserves realtime disk blocks
738 * dquots are unlocked on return, if they were not locked by caller.
741 xfs_trans_reserve_quota_bydquots(
742 struct xfs_trans *tp,
743 struct xfs_mount *mp,
744 struct xfs_dquot *udqp,
745 struct xfs_dquot *gdqp,
746 struct xfs_dquot *pdqp,
753 if (!XFS_IS_QUOTA_RUNNING(mp) || !XFS_IS_QUOTA_ON(mp))
756 if (tp && tp->t_dqinfo == NULL)
757 xfs_trans_alloc_dqinfo(tp);
759 ASSERT(flags & XFS_QMOPT_RESBLK_MASK);
762 error = xfs_trans_dqresv(tp, mp, udqp, nblks, ninos,
763 (flags & ~XFS_QMOPT_ENOSPC));
769 error = xfs_trans_dqresv(tp, mp, gdqp, nblks, ninos,
770 (flags & ~XFS_QMOPT_ENOSPC));
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.
838 struct xfs_qoff_logitem *
839 xfs_trans_get_qoff_item(
840 struct xfs_trans *tp,
841 struct xfs_qoff_logitem *startqoff,
844 struct xfs_qoff_logitem *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(
866 struct xfs_trans *tp,
867 struct xfs_qoff_logitem *qlp)
869 tp->t_flags |= XFS_TRANS_DIRTY;
870 set_bit(XFS_LI_DIRTY, &qlp->qql_item.li_flags);
874 xfs_trans_alloc_dqinfo(
877 tp->t_dqinfo = kmem_zone_zalloc(xfs_qm_dqtrxzone, 0);
881 xfs_trans_free_dqinfo(
886 kmem_zone_free(xfs_qm_dqtrxzone, tp->t_dqinfo);