Lines Matching +full:ip +full:- +full:blocks
1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
68 xfs_extent_busy_sort(&tp->t_busy); in xfs_trans_free()
69 xfs_extent_busy_clear(tp->t_mountp, &tp->t_busy, false); in xfs_trans_free()
73 if (!(tp->t_flags & XFS_TRANS_NO_WRITECOUNT)) in xfs_trans_free()
74 sb_end_intwrite(tp->t_mountp->m_super); in xfs_trans_free()
84 * blocks. Locks and log items, however, are no inherited. They must
100 ntp->t_magic = XFS_TRANS_HEADER_MAGIC; in xfs_trans_dup()
101 ntp->t_mountp = tp->t_mountp; in xfs_trans_dup()
102 INIT_LIST_HEAD(&ntp->t_items); in xfs_trans_dup()
103 INIT_LIST_HEAD(&ntp->t_busy); in xfs_trans_dup()
104 INIT_LIST_HEAD(&ntp->t_dfops); in xfs_trans_dup()
105 ntp->t_firstblock = NULLFSBLOCK; in xfs_trans_dup()
107 ASSERT(tp->t_flags & XFS_TRANS_PERM_LOG_RES); in xfs_trans_dup()
108 ASSERT(tp->t_ticket != NULL); in xfs_trans_dup()
110 ntp->t_flags = XFS_TRANS_PERM_LOG_RES | in xfs_trans_dup()
111 (tp->t_flags & XFS_TRANS_RESERVE) | in xfs_trans_dup()
112 (tp->t_flags & XFS_TRANS_NO_WRITECOUNT) | in xfs_trans_dup()
113 (tp->t_flags & XFS_TRANS_RES_FDBLKS); in xfs_trans_dup()
115 tp->t_flags |= XFS_TRANS_NO_WRITECOUNT; in xfs_trans_dup()
116 ntp->t_ticket = xfs_log_ticket_get(tp->t_ticket); in xfs_trans_dup()
118 ASSERT(tp->t_blk_res >= tp->t_blk_res_used); in xfs_trans_dup()
119 ntp->t_blk_res = tp->t_blk_res - tp->t_blk_res_used; in xfs_trans_dup()
120 tp->t_blk_res = tp->t_blk_res_used; in xfs_trans_dup()
122 ntp->t_rtx_res = tp->t_rtx_res - tp->t_rtx_res_used; in xfs_trans_dup()
123 tp->t_rtx_res = tp->t_rtx_res_used; in xfs_trans_dup()
135 * This is called to reserve free disk blocks and log space for the
139 * This will return ENOSPC if there are not enough blocks available.
152 uint blocks, in xfs_trans_reserve() argument
155 struct xfs_mount *mp = tp->t_mountp; in xfs_trans_reserve()
157 bool rsvd = (tp->t_flags & XFS_TRANS_RESERVE) != 0; in xfs_trans_reserve()
160 * Attempt to reserve the needed disk blocks by decrementing in xfs_trans_reserve()
164 if (blocks > 0) { in xfs_trans_reserve()
165 error = xfs_mod_fdblocks(mp, -((int64_t)blocks), rsvd); in xfs_trans_reserve()
167 return -ENOSPC; in xfs_trans_reserve()
168 tp->t_blk_res += blocks; in xfs_trans_reserve()
174 if (resp->tr_logres > 0) { in xfs_trans_reserve()
177 ASSERT(tp->t_log_res == 0 || in xfs_trans_reserve()
178 tp->t_log_res == resp->tr_logres); in xfs_trans_reserve()
179 ASSERT(tp->t_log_count == 0 || in xfs_trans_reserve()
180 tp->t_log_count == resp->tr_logcount); in xfs_trans_reserve()
182 if (resp->tr_logflags & XFS_TRANS_PERM_LOG_RES) { in xfs_trans_reserve()
183 tp->t_flags |= XFS_TRANS_PERM_LOG_RES; in xfs_trans_reserve()
186 ASSERT(tp->t_ticket == NULL); in xfs_trans_reserve()
187 ASSERT(!(tp->t_flags & XFS_TRANS_PERM_LOG_RES)); in xfs_trans_reserve()
190 if (tp->t_ticket != NULL) { in xfs_trans_reserve()
191 ASSERT(resp->tr_logflags & XFS_TRANS_PERM_LOG_RES); in xfs_trans_reserve()
192 error = xfs_log_regrant(mp, tp->t_ticket); in xfs_trans_reserve()
194 error = xfs_log_reserve(mp, resp->tr_logres, in xfs_trans_reserve()
195 resp->tr_logcount, in xfs_trans_reserve()
196 &tp->t_ticket, permanent); in xfs_trans_reserve()
202 tp->t_log_res = resp->tr_logres; in xfs_trans_reserve()
203 tp->t_log_count = resp->tr_logcount; in xfs_trans_reserve()
212 error = xfs_mod_frextents(mp, -((int64_t)rtextents)); in xfs_trans_reserve()
214 error = -ENOSPC; in xfs_trans_reserve()
217 tp->t_rtx_res += rtextents; in xfs_trans_reserve()
227 if (resp->tr_logres > 0) { in xfs_trans_reserve()
228 xfs_log_ticket_ungrant(mp->m_log, tp->t_ticket); in xfs_trans_reserve()
229 tp->t_ticket = NULL; in xfs_trans_reserve()
230 tp->t_log_res = 0; in xfs_trans_reserve()
231 tp->t_flags &= ~XFS_TRANS_PERM_LOG_RES; in xfs_trans_reserve()
235 if (blocks > 0) { in xfs_trans_reserve()
236 xfs_mod_fdblocks(mp, (int64_t)blocks, rsvd); in xfs_trans_reserve()
237 tp->t_blk_res = 0; in xfs_trans_reserve()
246 uint blocks, in xfs_trans_alloc() argument
263 sb_start_intwrite(mp->m_super); in xfs_trans_alloc()
267 * Zero-reservation ("empty") transactions can't modify anything, so in xfs_trans_alloc()
270 WARN_ON(resp->tr_logres > 0 && in xfs_trans_alloc()
271 mp->m_super->s_writers.frozen == SB_FREEZE_COMPLETE); in xfs_trans_alloc()
275 tp->t_magic = XFS_TRANS_HEADER_MAGIC; in xfs_trans_alloc()
276 tp->t_flags = flags; in xfs_trans_alloc()
277 tp->t_mountp = mp; in xfs_trans_alloc()
278 INIT_LIST_HEAD(&tp->t_items); in xfs_trans_alloc()
279 INIT_LIST_HEAD(&tp->t_busy); in xfs_trans_alloc()
280 INIT_LIST_HEAD(&tp->t_dfops); in xfs_trans_alloc()
281 tp->t_firstblock = NULLFSBLOCK; in xfs_trans_alloc()
283 error = xfs_trans_reserve(tp, resp, blocks, rtextents); in xfs_trans_alloc()
284 if (error == -ENOSPC && want_retry) { in xfs_trans_alloc()
310 * mechanism for routines that query metadata without actually modifying them --
311 * if the metadata being queried is somehow cross-linked (think a btree block
312 * pointer that points higher in the tree), we risk deadlock. However, blocks
313 * grabbed as part of a transaction can be re-grabbed. The verifiers will
317 * Note the zero-length reservation; this transaction MUST be cancelled without
343 * used filesystem blocks in the superblock, we do not mark the
357 xfs_mount_t *mp = tp->t_mountp; in xfs_trans_mod_sb()
361 tp->t_icount_delta += delta; in xfs_trans_mod_sb()
366 tp->t_ifree_delta += delta; in xfs_trans_mod_sb()
372 * Track the number of blocks allocated in the transaction. in xfs_trans_mod_sb()
377 tp->t_blk_res_used += (uint)-delta; in xfs_trans_mod_sb()
378 if (tp->t_blk_res_used > tp->t_blk_res) in xfs_trans_mod_sb()
380 } else if (delta > 0 && (tp->t_flags & XFS_TRANS_RES_FDBLKS)) { in xfs_trans_mod_sb()
384 * Return freed blocks directly to the reservation in xfs_trans_mod_sb()
388 * repeatedly free and allocate blocks. in xfs_trans_mod_sb()
391 UINT_MAX - tp->t_blk_res); in xfs_trans_mod_sb()
392 tp->t_blk_res += blkres_delta; in xfs_trans_mod_sb()
393 delta -= blkres_delta; in xfs_trans_mod_sb()
395 tp->t_fdblocks_delta += delta; in xfs_trans_mod_sb()
402 * in-core superblock's counter. This should only in xfs_trans_mod_sb()
403 * be applied to the on-disk superblock. in xfs_trans_mod_sb()
405 tp->t_res_fdblocks_delta += delta; in xfs_trans_mod_sb()
411 * Track the number of blocks allocated in the in xfs_trans_mod_sb()
416 tp->t_rtx_res_used += (uint)-delta; in xfs_trans_mod_sb()
417 ASSERT(tp->t_rtx_res_used <= tp->t_rtx_res); in xfs_trans_mod_sb()
419 tp->t_frextents_delta += delta; in xfs_trans_mod_sb()
424 * in-core superblock's counter. This should only in xfs_trans_mod_sb()
425 * be applied to the on-disk superblock. in xfs_trans_mod_sb()
428 tp->t_res_frextents_delta += delta; in xfs_trans_mod_sb()
431 tp->t_dblocks_delta += delta; in xfs_trans_mod_sb()
435 tp->t_agcount_delta += delta; in xfs_trans_mod_sb()
438 tp->t_imaxpct_delta += delta; in xfs_trans_mod_sb()
441 tp->t_rextsize_delta += delta; in xfs_trans_mod_sb()
444 tp->t_rbmblocks_delta += delta; in xfs_trans_mod_sb()
447 tp->t_rblocks_delta += delta; in xfs_trans_mod_sb()
450 tp->t_rextents_delta += delta; in xfs_trans_mod_sb()
453 tp->t_rextslog_delta += delta; in xfs_trans_mod_sb()
460 tp->t_flags |= flags; in xfs_trans_mod_sb()
480 sbp = bp->b_addr; in xfs_trans_apply_sb_deltas()
485 if (!xfs_has_lazysbcount((tp->t_mountp))) { in xfs_trans_apply_sb_deltas()
486 if (tp->t_icount_delta) in xfs_trans_apply_sb_deltas()
487 be64_add_cpu(&sbp->sb_icount, tp->t_icount_delta); in xfs_trans_apply_sb_deltas()
488 if (tp->t_ifree_delta) in xfs_trans_apply_sb_deltas()
489 be64_add_cpu(&sbp->sb_ifree, tp->t_ifree_delta); in xfs_trans_apply_sb_deltas()
490 if (tp->t_fdblocks_delta) in xfs_trans_apply_sb_deltas()
491 be64_add_cpu(&sbp->sb_fdblocks, tp->t_fdblocks_delta); in xfs_trans_apply_sb_deltas()
492 if (tp->t_res_fdblocks_delta) in xfs_trans_apply_sb_deltas()
493 be64_add_cpu(&sbp->sb_fdblocks, tp->t_res_fdblocks_delta); in xfs_trans_apply_sb_deltas()
510 if (tp->t_frextents_delta || tp->t_res_frextents_delta) { in xfs_trans_apply_sb_deltas()
511 struct xfs_mount *mp = tp->t_mountp; in xfs_trans_apply_sb_deltas()
514 rtxdelta = tp->t_frextents_delta + tp->t_res_frextents_delta; in xfs_trans_apply_sb_deltas()
516 spin_lock(&mp->m_sb_lock); in xfs_trans_apply_sb_deltas()
517 be64_add_cpu(&sbp->sb_frextents, rtxdelta); in xfs_trans_apply_sb_deltas()
518 mp->m_sb.sb_frextents += rtxdelta; in xfs_trans_apply_sb_deltas()
519 spin_unlock(&mp->m_sb_lock); in xfs_trans_apply_sb_deltas()
522 if (tp->t_dblocks_delta) { in xfs_trans_apply_sb_deltas()
523 be64_add_cpu(&sbp->sb_dblocks, tp->t_dblocks_delta); in xfs_trans_apply_sb_deltas()
526 if (tp->t_agcount_delta) { in xfs_trans_apply_sb_deltas()
527 be32_add_cpu(&sbp->sb_agcount, tp->t_agcount_delta); in xfs_trans_apply_sb_deltas()
530 if (tp->t_imaxpct_delta) { in xfs_trans_apply_sb_deltas()
531 sbp->sb_imax_pct += tp->t_imaxpct_delta; in xfs_trans_apply_sb_deltas()
534 if (tp->t_rextsize_delta) { in xfs_trans_apply_sb_deltas()
535 be32_add_cpu(&sbp->sb_rextsize, tp->t_rextsize_delta); in xfs_trans_apply_sb_deltas()
538 if (tp->t_rbmblocks_delta) { in xfs_trans_apply_sb_deltas()
539 be32_add_cpu(&sbp->sb_rbmblocks, tp->t_rbmblocks_delta); in xfs_trans_apply_sb_deltas()
542 if (tp->t_rblocks_delta) { in xfs_trans_apply_sb_deltas()
543 be64_add_cpu(&sbp->sb_rblocks, tp->t_rblocks_delta); in xfs_trans_apply_sb_deltas()
546 if (tp->t_rextents_delta) { in xfs_trans_apply_sb_deltas()
547 be64_add_cpu(&sbp->sb_rextents, tp->t_rextents_delta); in xfs_trans_apply_sb_deltas()
550 if (tp->t_rextslog_delta) { in xfs_trans_apply_sb_deltas()
551 sbp->sb_rextslog += tp->t_rextslog_delta; in xfs_trans_apply_sb_deltas()
560 xfs_trans_log_buf(tp, bp, 0, sizeof(struct xfs_dsb) - 1); in xfs_trans_apply_sb_deltas()
568 sizeof(sbp->sb_frextents) - 1); in xfs_trans_apply_sb_deltas()
573 * apply superblock counter changes to the in-core superblock. The
575 * applied to the in-core superblock. The idea is that that has already been
583 * Deltas for the inode count are +/-64, hence we use a large batch size of 128
592 struct xfs_mount *mp = tp->t_mountp; in xfs_trans_unreserve_and_mod_sb()
593 bool rsvd = (tp->t_flags & XFS_TRANS_RESERVE) != 0; in xfs_trans_unreserve_and_mod_sb()
601 if (tp->t_blk_res > 0) in xfs_trans_unreserve_and_mod_sb()
602 blkdelta = tp->t_blk_res; in xfs_trans_unreserve_and_mod_sb()
603 if ((tp->t_fdblocks_delta != 0) && in xfs_trans_unreserve_and_mod_sb()
605 (tp->t_flags & XFS_TRANS_SB_DIRTY))) in xfs_trans_unreserve_and_mod_sb()
606 blkdelta += tp->t_fdblocks_delta; in xfs_trans_unreserve_and_mod_sb()
608 if (tp->t_rtx_res > 0) in xfs_trans_unreserve_and_mod_sb()
609 rtxdelta = tp->t_rtx_res; in xfs_trans_unreserve_and_mod_sb()
610 if ((tp->t_frextents_delta != 0) && in xfs_trans_unreserve_and_mod_sb()
611 (tp->t_flags & XFS_TRANS_SB_DIRTY)) in xfs_trans_unreserve_and_mod_sb()
612 rtxdelta += tp->t_frextents_delta; in xfs_trans_unreserve_and_mod_sb()
615 (tp->t_flags & XFS_TRANS_SB_DIRTY)) { in xfs_trans_unreserve_and_mod_sb()
616 idelta = tp->t_icount_delta; in xfs_trans_unreserve_and_mod_sb()
617 ifreedelta = tp->t_ifree_delta; in xfs_trans_unreserve_and_mod_sb()
620 /* apply the per-cpu counters */ in xfs_trans_unreserve_and_mod_sb()
627 percpu_counter_add_batch(&mp->m_icount, idelta, in xfs_trans_unreserve_and_mod_sb()
631 percpu_counter_add(&mp->m_ifree, ifreedelta); in xfs_trans_unreserve_and_mod_sb()
638 if (!(tp->t_flags & XFS_TRANS_SB_DIRTY)) in xfs_trans_unreserve_and_mod_sb()
642 spin_lock(&mp->m_sb_lock); in xfs_trans_unreserve_and_mod_sb()
643 mp->m_sb.sb_fdblocks += tp->t_fdblocks_delta + tp->t_res_fdblocks_delta; in xfs_trans_unreserve_and_mod_sb()
644 mp->m_sb.sb_icount += idelta; in xfs_trans_unreserve_and_mod_sb()
645 mp->m_sb.sb_ifree += ifreedelta; in xfs_trans_unreserve_and_mod_sb()
652 mp->m_sb.sb_dblocks += tp->t_dblocks_delta; in xfs_trans_unreserve_and_mod_sb()
653 mp->m_sb.sb_agcount += tp->t_agcount_delta; in xfs_trans_unreserve_and_mod_sb()
654 mp->m_sb.sb_imax_pct += tp->t_imaxpct_delta; in xfs_trans_unreserve_and_mod_sb()
655 mp->m_sb.sb_rextsize += tp->t_rextsize_delta; in xfs_trans_unreserve_and_mod_sb()
656 mp->m_sb.sb_rbmblocks += tp->t_rbmblocks_delta; in xfs_trans_unreserve_and_mod_sb()
657 mp->m_sb.sb_rblocks += tp->t_rblocks_delta; in xfs_trans_unreserve_and_mod_sb()
658 mp->m_sb.sb_rextents += tp->t_rextents_delta; in xfs_trans_unreserve_and_mod_sb()
659 mp->m_sb.sb_rextslog += tp->t_rextslog_delta; in xfs_trans_unreserve_and_mod_sb()
660 spin_unlock(&mp->m_sb_lock); in xfs_trans_unreserve_and_mod_sb()
666 ASSERT(mp->m_sb.sb_imax_pct >= 0); in xfs_trans_unreserve_and_mod_sb()
667 ASSERT(mp->m_sb.sb_rextslog >= 0); in xfs_trans_unreserve_and_mod_sb()
677 ASSERT(lip->li_log == tp->t_mountp->m_log); in xfs_trans_add_item()
678 ASSERT(lip->li_ailp == tp->t_mountp->m_ail); in xfs_trans_add_item()
679 ASSERT(list_empty(&lip->li_trans)); in xfs_trans_add_item()
680 ASSERT(!test_bit(XFS_LI_DIRTY, &lip->li_flags)); in xfs_trans_add_item()
682 list_add_tail(&lip->li_trans, &tp->t_items); in xfs_trans_add_item()
695 clear_bit(XFS_LI_DIRTY, &lip->li_flags); in xfs_trans_del_item()
696 list_del_init(&lip->li_trans); in xfs_trans_del_item()
709 list_for_each_entry_safe(lip, next, &tp->t_items, li_trans) { in xfs_trans_free_items()
712 set_bit(XFS_LI_ABORTED, &lip->li_flags); in xfs_trans_free_items()
713 if (lip->li_ops->iop_release) in xfs_trans_free_items()
714 lip->li_ops->iop_release(lip); in xfs_trans_free_items()
728 spin_lock(&ailp->ail_lock); in xfs_log_item_batch_insert()
729 /* xfs_trans_ail_update_bulk drops ailp->ail_lock */ in xfs_log_item_batch_insert()
735 if (lip->li_ops->iop_unpin) in xfs_log_item_batch_insert()
736 lip->li_ops->iop_unpin(lip, 0); in xfs_log_item_batch_insert()
773 spin_lock(&ailp->ail_lock); in xfs_trans_committed_bulk()
775 spin_unlock(&ailp->ail_lock); in xfs_trans_committed_bulk()
779 struct xfs_log_item *lip = lv->lv_item; in xfs_trans_committed_bulk()
783 set_bit(XFS_LI_ABORTED, &lip->li_flags); in xfs_trans_committed_bulk()
785 if (lip->li_ops->flags & XFS_ITEM_RELEASE_WHEN_COMMITTED) { in xfs_trans_committed_bulk()
786 lip->li_ops->iop_release(lip); in xfs_trans_committed_bulk()
790 if (lip->li_ops->iop_committed) in xfs_trans_committed_bulk()
791 item_lsn = lip->li_ops->iop_committed(lip, commit_lsn); in xfs_trans_committed_bulk()
795 /* item_lsn of -1 means the item needs no further processing */ in xfs_trans_committed_bulk()
796 if (XFS_LSN_CMP(item_lsn, (xfs_lsn_t)-1) == 0) in xfs_trans_committed_bulk()
804 ASSERT(xlog_is_shutdown(ailp->ail_log)); in xfs_trans_committed_bulk()
805 if (lip->li_ops->iop_unpin) in xfs_trans_committed_bulk()
806 lip->li_ops->iop_unpin(lip, 1); in xfs_trans_committed_bulk()
819 spin_lock(&ailp->ail_lock); in xfs_trans_committed_bulk()
820 if (XFS_LSN_CMP(item_lsn, lip->li_lsn) > 0) in xfs_trans_committed_bulk()
823 spin_unlock(&ailp->ail_lock); in xfs_trans_committed_bulk()
824 if (lip->li_ops->iop_unpin) in xfs_trans_committed_bulk()
825 lip->li_ops->iop_unpin(lip, 0); in xfs_trans_committed_bulk()
830 log_items[i++] = lv->lv_item; in xfs_trans_committed_bulk()
842 spin_lock(&ailp->ail_lock); in xfs_trans_committed_bulk()
844 spin_unlock(&ailp->ail_lock); in xfs_trans_committed_bulk()
871 * If both items are non-sortable, leave them alone. If only one is in xfs_trans_precommit_sort()
872 * sortable, move the non-sortable item towards the end of the list. in xfs_trans_precommit_sort()
874 if (!lia->li_ops->iop_sort && !lib->li_ops->iop_sort) in xfs_trans_precommit_sort()
876 if (!lia->li_ops->iop_sort) in xfs_trans_precommit_sort()
878 if (!lib->li_ops->iop_sort) in xfs_trans_precommit_sort()
879 return -1; in xfs_trans_precommit_sort()
881 diff = lia->li_ops->iop_sort(lia) - lib->li_ops->iop_sort(lib); in xfs_trans_precommit_sort()
883 return -1; in xfs_trans_precommit_sort()
900 struct xfs_mount *mp = tp->t_mountp; in xfs_trans_run_precommits()
909 list_sort(NULL, &tp->t_items, xfs_trans_precommit_sort); in xfs_trans_run_precommits()
917 list_for_each_entry_safe(lip, n, &tp->t_items, li_trans) { in xfs_trans_run_precommits()
918 if (!test_bit(XFS_LI_DIRTY, &lip->li_flags)) in xfs_trans_run_precommits()
920 if (lip->li_ops->iop_precommit) { in xfs_trans_run_precommits()
921 error = lip->li_ops->iop_precommit(tp, lip); in xfs_trans_run_precommits()
937 * be durable - ie. committed to disk - because some metadata might
948 struct xfs_mount *mp = tp->t_mountp; in __xfs_trans_commit()
949 struct xlog *log = mp->m_log; in __xfs_trans_commit()
952 int sync = tp->t_flags & XFS_TRANS_SYNC; in __xfs_trans_commit()
958 if (tp->t_flags & XFS_TRANS_PERM_LOG_RES) in __xfs_trans_commit()
967 WARN_ON_ONCE(!list_empty(&tp->t_dfops) && in __xfs_trans_commit()
968 !(tp->t_flags & XFS_TRANS_PERM_LOG_RES)); in __xfs_trans_commit()
969 if (!regrant && (tp->t_flags & XFS_TRANS_PERM_LOG_RES)) { in __xfs_trans_commit()
979 * Also make sure to return any reserved blocks to in __xfs_trans_commit()
982 if (!(tp->t_flags & XFS_TRANS_DIRTY)) in __xfs_trans_commit()
989 * disk, and that will lead to on-disk corruption. in __xfs_trans_commit()
992 error = -EIO; in __xfs_trans_commit()
996 ASSERT(tp->t_ticket != NULL); in __xfs_trans_commit()
1001 if (tp->t_flags & XFS_TRANS_SB_DIRTY) in __xfs_trans_commit()
1028 * (non-persistent) quota reservations that need to be unreserved. in __xfs_trans_commit()
1031 if (tp->t_ticket) { in __xfs_trans_commit()
1033 xfs_log_ticket_regrant(log, tp->t_ticket); in __xfs_trans_commit()
1035 xfs_log_ticket_ungrant(log, tp->t_ticket); in __xfs_trans_commit()
1036 tp->t_ticket = NULL; in __xfs_trans_commit()
1072 struct xfs_mount *mp = tp->t_mountp; in xfs_trans_cancel()
1073 struct xlog *log = mp->m_log; in xfs_trans_cancel()
1074 bool dirty = (tp->t_flags & XFS_TRANS_DIRTY); in xfs_trans_cancel()
1081 * loudly before freeing the in-memory defer items. in xfs_trans_cancel()
1083 if (!list_empty(&tp->t_dfops)) { in xfs_trans_cancel()
1084 ASSERT(xfs_is_shutdown(mp) || list_empty(&tp->t_dfops)); in xfs_trans_cancel()
1085 ASSERT(tp->t_flags & XFS_TRANS_PERM_LOG_RES); in xfs_trans_cancel()
1105 list_for_each_entry(lip, &tp->t_items, li_trans) in xfs_trans_cancel()
1112 if (tp->t_ticket) { in xfs_trans_cancel()
1113 xfs_log_ticket_ungrant(log, tp->t_ticket); in xfs_trans_cancel()
1114 tp->t_ticket = NULL; in xfs_trans_cancel()
1141 tres.tr_logres = trans->t_log_res; in xfs_trans_roll()
1142 tres.tr_logcount = trans->t_log_count; in xfs_trans_roll()
1172 * The caller must ensure that the on-disk dquots attached to this inode have
1178 struct xfs_inode *ip, in xfs_trans_alloc_inode() argument
1186 struct xfs_mount *mp = ip->i_mount; in xfs_trans_alloc_inode()
1192 rblocks / mp->m_sb.sb_rextsize, in xfs_trans_alloc_inode()
1197 xfs_ilock(ip, XFS_ILOCK_EXCL); in xfs_trans_alloc_inode()
1198 xfs_trans_ijoin(tp, ip, 0); in xfs_trans_alloc_inode()
1200 error = xfs_qm_dqattach_locked(ip, false); in xfs_trans_alloc_inode()
1203 ASSERT(error != -ENOENT); in xfs_trans_alloc_inode()
1207 error = xfs_trans_reserve_quota_nblks(tp, ip, dblocks, rblocks, force); in xfs_trans_alloc_inode()
1208 if ((error == -EDQUOT || error == -ENOSPC) && !retried) { in xfs_trans_alloc_inode()
1210 xfs_iunlock(ip, XFS_ILOCK_EXCL); in xfs_trans_alloc_inode()
1211 xfs_blockgc_free_quota(ip, 0); in xfs_trans_alloc_inode()
1223 xfs_iunlock(ip, XFS_ILOCK_EXCL); in xfs_trans_alloc_inode()
1251 if ((error == -EDQUOT || error == -ENOSPC) && !retried) { in xfs_trans_alloc_icreate()
1271 * The caller must ensure that the on-disk dquots attached to this inode have
1277 struct xfs_inode *ip, in xfs_trans_alloc_ichange() argument
1285 struct xfs_mount *mp = ip->i_mount; in xfs_trans_alloc_ichange()
1293 error = xfs_trans_alloc(mp, &M_RES(mp)->tr_ichange, 0, 0, 0, &tp); in xfs_trans_alloc_ichange()
1297 xfs_ilock(ip, XFS_ILOCK_EXCL); in xfs_trans_alloc_ichange()
1298 xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); in xfs_trans_alloc_ichange()
1300 error = xfs_qm_dqattach_locked(ip, false); in xfs_trans_alloc_ichange()
1303 ASSERT(error != -ENOENT); in xfs_trans_alloc_ichange()
1313 udqp = (new_udqp != ip->i_udquot) ? new_udqp : NULL; in xfs_trans_alloc_ichange()
1314 gdqp = (new_gdqp != ip->i_gdquot) ? new_gdqp : NULL; in xfs_trans_alloc_ichange()
1315 pdqp = (new_pdqp != ip->i_pdquot) ? new_pdqp : NULL; in xfs_trans_alloc_ichange()
1323 * Reserve enough quota to handle blocks on disk and reserved in xfs_trans_alloc_ichange()
1326 * though that part is only semi-transactional. in xfs_trans_alloc_ichange()
1329 pdqp, ip->i_nblocks + ip->i_delayed_blks, in xfs_trans_alloc_ichange()
1331 if ((error == -EDQUOT || error == -ENOSPC) && !retried) { in xfs_trans_alloc_ichange()
1356 * The caller must ensure that the on-disk dquots attached to this inode have
1364 struct xfs_inode *ip, in xfs_trans_alloc_dir() argument
1370 struct xfs_mount *mp = ip->i_mount; in xfs_trans_alloc_dir()
1379 if (error == -ENOSPC) { in xfs_trans_alloc_dir()
1387 xfs_lock_two_inodes(dp, XFS_ILOCK_EXCL, ip, XFS_ILOCK_EXCL); in xfs_trans_alloc_dir()
1390 xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); in xfs_trans_alloc_dir()
1395 ASSERT(error != -ENOENT); in xfs_trans_alloc_dir()
1399 error = xfs_qm_dqattach_locked(ip, false); in xfs_trans_alloc_dir()
1402 ASSERT(error != -ENOENT); in xfs_trans_alloc_dir()
1410 if (error == -EDQUOT || error == -ENOSPC) { in xfs_trans_alloc_dir()