Lines Matching refs:tp
247 xfs_trans_t *tp; in _xfs_trans_alloc() local
251 tp = kmem_zone_zalloc(xfs_trans_zone, KM_SLEEP); in _xfs_trans_alloc()
252 tp->t_magic = XFS_TRANS_MAGIC; in _xfs_trans_alloc()
253 tp->t_type = type; in _xfs_trans_alloc()
254 tp->t_mountp = mp; in _xfs_trans_alloc()
255 tp->t_items_free = XFS_LIC_NUM_SLOTS; in _xfs_trans_alloc()
256 tp->t_busy_free = XFS_LBC_NUM_SLOTS; in _xfs_trans_alloc()
257 xfs_lic_init(&(tp->t_items)); in _xfs_trans_alloc()
258 XFS_LBC_INIT(&(tp->t_busy)); in _xfs_trans_alloc()
259 return tp; in _xfs_trans_alloc()
272 xfs_trans_t *tp) in xfs_trans_dup() argument
282 ntp->t_type = tp->t_type; in xfs_trans_dup()
283 ntp->t_mountp = tp->t_mountp; in xfs_trans_dup()
289 ASSERT(tp->t_flags & XFS_TRANS_PERM_LOG_RES); in xfs_trans_dup()
290 ASSERT(tp->t_ticket != NULL); in xfs_trans_dup()
292 ntp->t_flags = XFS_TRANS_PERM_LOG_RES | (tp->t_flags & XFS_TRANS_RESERVE); in xfs_trans_dup()
293 ntp->t_ticket = xfs_log_ticket_get(tp->t_ticket); in xfs_trans_dup()
294 ntp->t_blk_res = tp->t_blk_res - tp->t_blk_res_used; in xfs_trans_dup()
295 tp->t_blk_res = tp->t_blk_res_used; in xfs_trans_dup()
296 ntp->t_rtx_res = tp->t_rtx_res - tp->t_rtx_res_used; in xfs_trans_dup()
297 tp->t_rtx_res = tp->t_rtx_res_used; in xfs_trans_dup()
298 ntp->t_pflags = tp->t_pflags; in xfs_trans_dup()
300 XFS_TRANS_DUP_DQINFO(tp->t_mountp, tp, ntp); in xfs_trans_dup()
302 atomic_inc(&tp->t_mountp->m_active_trans); in xfs_trans_dup()
322 xfs_trans_t *tp, in xfs_trans_reserve() argument
331 int rsvd = (tp->t_flags & XFS_TRANS_RESERVE) != 0; in xfs_trans_reserve()
334 current_set_flags_nested(&tp->t_pflags, PF_FSTRANS); in xfs_trans_reserve()
342 error = xfs_mod_incore_sb(tp->t_mountp, XFS_SBS_FDBLOCKS, in xfs_trans_reserve()
345 current_restore_flags_nested(&tp->t_pflags, PF_FSTRANS); in xfs_trans_reserve()
348 tp->t_blk_res += blocks; in xfs_trans_reserve()
355 ASSERT((tp->t_log_res == 0) || (tp->t_log_res == logspace)); in xfs_trans_reserve()
356 ASSERT((tp->t_log_count == 0) || in xfs_trans_reserve()
357 (tp->t_log_count == logcount)); in xfs_trans_reserve()
360 tp->t_flags |= XFS_TRANS_PERM_LOG_RES; in xfs_trans_reserve()
362 ASSERT(tp->t_ticket == NULL); in xfs_trans_reserve()
363 ASSERT(!(tp->t_flags & XFS_TRANS_PERM_LOG_RES)); in xfs_trans_reserve()
367 error = xfs_log_reserve(tp->t_mountp, logspace, logcount, in xfs_trans_reserve()
368 &tp->t_ticket, in xfs_trans_reserve()
369 XFS_TRANSACTION, log_flags, tp->t_type); in xfs_trans_reserve()
373 tp->t_log_res = logspace; in xfs_trans_reserve()
374 tp->t_log_count = logcount; in xfs_trans_reserve()
383 error = xfs_mod_incore_sb(tp->t_mountp, XFS_SBS_FREXTENTS, in xfs_trans_reserve()
389 tp->t_rtx_res += rtextents; in xfs_trans_reserve()
405 xfs_log_done(tp->t_mountp, tp->t_ticket, NULL, log_flags); in xfs_trans_reserve()
406 tp->t_ticket = NULL; in xfs_trans_reserve()
407 tp->t_log_res = 0; in xfs_trans_reserve()
408 tp->t_flags &= ~XFS_TRANS_PERM_LOG_RES; in xfs_trans_reserve()
413 (void) xfs_mod_incore_sb(tp->t_mountp, XFS_SBS_FDBLOCKS, in xfs_trans_reserve()
415 tp->t_blk_res = 0; in xfs_trans_reserve()
418 current_restore_flags_nested(&tp->t_pflags, PF_FSTRANS); in xfs_trans_reserve()
442 xfs_trans_t *tp, in xfs_trans_mod_sb() argument
447 xfs_mount_t *mp = tp->t_mountp; in xfs_trans_mod_sb()
451 tp->t_icount_delta += delta; in xfs_trans_mod_sb()
456 tp->t_ifree_delta += delta; in xfs_trans_mod_sb()
467 tp->t_blk_res_used += (uint)-delta; in xfs_trans_mod_sb()
468 ASSERT(tp->t_blk_res_used <= tp->t_blk_res); in xfs_trans_mod_sb()
470 tp->t_fdblocks_delta += delta; in xfs_trans_mod_sb()
481 tp->t_res_fdblocks_delta += delta; in xfs_trans_mod_sb()
492 tp->t_rtx_res_used += (uint)-delta; in xfs_trans_mod_sb()
493 ASSERT(tp->t_rtx_res_used <= tp->t_rtx_res); in xfs_trans_mod_sb()
495 tp->t_frextents_delta += delta; in xfs_trans_mod_sb()
504 tp->t_res_frextents_delta += delta; in xfs_trans_mod_sb()
508 tp->t_dblocks_delta += delta; in xfs_trans_mod_sb()
512 tp->t_agcount_delta += delta; in xfs_trans_mod_sb()
515 tp->t_imaxpct_delta += delta; in xfs_trans_mod_sb()
518 tp->t_rextsize_delta += delta; in xfs_trans_mod_sb()
521 tp->t_rbmblocks_delta += delta; in xfs_trans_mod_sb()
524 tp->t_rblocks_delta += delta; in xfs_trans_mod_sb()
527 tp->t_rextents_delta += delta; in xfs_trans_mod_sb()
530 tp->t_rextslog_delta += delta; in xfs_trans_mod_sb()
537 tp->t_flags |= flags; in xfs_trans_mod_sb()
550 xfs_trans_t *tp) in xfs_trans_apply_sb_deltas() argument
556 bp = xfs_trans_getsb(tp, tp->t_mountp, 0); in xfs_trans_apply_sb_deltas()
562 ASSERT((tp->t_fdblocks_delta + tp->t_res_fdblocks_delta) == in xfs_trans_apply_sb_deltas()
563 (tp->t_ag_freeblks_delta + tp->t_ag_flist_delta + in xfs_trans_apply_sb_deltas()
564 tp->t_ag_btree_delta)); in xfs_trans_apply_sb_deltas()
569 if (!xfs_sb_version_haslazysbcount(&(tp->t_mountp->m_sb))) { in xfs_trans_apply_sb_deltas()
570 if (tp->t_icount_delta) in xfs_trans_apply_sb_deltas()
571 be64_add_cpu(&sbp->sb_icount, tp->t_icount_delta); in xfs_trans_apply_sb_deltas()
572 if (tp->t_ifree_delta) in xfs_trans_apply_sb_deltas()
573 be64_add_cpu(&sbp->sb_ifree, tp->t_ifree_delta); in xfs_trans_apply_sb_deltas()
574 if (tp->t_fdblocks_delta) in xfs_trans_apply_sb_deltas()
575 be64_add_cpu(&sbp->sb_fdblocks, tp->t_fdblocks_delta); in xfs_trans_apply_sb_deltas()
576 if (tp->t_res_fdblocks_delta) in xfs_trans_apply_sb_deltas()
577 be64_add_cpu(&sbp->sb_fdblocks, tp->t_res_fdblocks_delta); in xfs_trans_apply_sb_deltas()
580 if (tp->t_frextents_delta) in xfs_trans_apply_sb_deltas()
581 be64_add_cpu(&sbp->sb_frextents, tp->t_frextents_delta); in xfs_trans_apply_sb_deltas()
582 if (tp->t_res_frextents_delta) in xfs_trans_apply_sb_deltas()
583 be64_add_cpu(&sbp->sb_frextents, tp->t_res_frextents_delta); in xfs_trans_apply_sb_deltas()
585 if (tp->t_dblocks_delta) { in xfs_trans_apply_sb_deltas()
586 be64_add_cpu(&sbp->sb_dblocks, tp->t_dblocks_delta); in xfs_trans_apply_sb_deltas()
589 if (tp->t_agcount_delta) { in xfs_trans_apply_sb_deltas()
590 be32_add_cpu(&sbp->sb_agcount, tp->t_agcount_delta); in xfs_trans_apply_sb_deltas()
593 if (tp->t_imaxpct_delta) { in xfs_trans_apply_sb_deltas()
594 sbp->sb_imax_pct += tp->t_imaxpct_delta; in xfs_trans_apply_sb_deltas()
597 if (tp->t_rextsize_delta) { in xfs_trans_apply_sb_deltas()
598 be32_add_cpu(&sbp->sb_rextsize, tp->t_rextsize_delta); in xfs_trans_apply_sb_deltas()
601 if (tp->t_rbmblocks_delta) { in xfs_trans_apply_sb_deltas()
602 be32_add_cpu(&sbp->sb_rbmblocks, tp->t_rbmblocks_delta); in xfs_trans_apply_sb_deltas()
605 if (tp->t_rblocks_delta) { in xfs_trans_apply_sb_deltas()
606 be64_add_cpu(&sbp->sb_rblocks, tp->t_rblocks_delta); in xfs_trans_apply_sb_deltas()
609 if (tp->t_rextents_delta) { in xfs_trans_apply_sb_deltas()
610 be64_add_cpu(&sbp->sb_rextents, tp->t_rextents_delta); in xfs_trans_apply_sb_deltas()
613 if (tp->t_rextslog_delta) { in xfs_trans_apply_sb_deltas()
614 sbp->sb_rextslog += tp->t_rextslog_delta; in xfs_trans_apply_sb_deltas()
622 xfs_trans_log_buf(tp, bp, 0, sizeof(xfs_dsb_t) - 1); in xfs_trans_apply_sb_deltas()
628 xfs_trans_log_buf(tp, bp, offsetof(xfs_dsb_t, sb_icount), in xfs_trans_apply_sb_deltas()
632 tp->t_mountp->m_super->s_dirt = 1; in xfs_trans_apply_sb_deltas()
656 xfs_trans_t *tp) in xfs_trans_unreserve_and_mod_sb() argument
660 xfs_mount_t *mp = tp->t_mountp; in xfs_trans_unreserve_and_mod_sb()
668 rsvd = (tp->t_flags & XFS_TRANS_RESERVE) != 0; in xfs_trans_unreserve_and_mod_sb()
671 if (tp->t_blk_res > 0) in xfs_trans_unreserve_and_mod_sb()
672 blkdelta = tp->t_blk_res; in xfs_trans_unreserve_and_mod_sb()
674 if ((tp->t_fdblocks_delta != 0) && in xfs_trans_unreserve_and_mod_sb()
676 (tp->t_flags & XFS_TRANS_SB_DIRTY))) in xfs_trans_unreserve_and_mod_sb()
677 blkdelta += tp->t_fdblocks_delta; in xfs_trans_unreserve_and_mod_sb()
686 if (tp->t_rtx_res > 0) in xfs_trans_unreserve_and_mod_sb()
687 rtxdelta = tp->t_rtx_res; in xfs_trans_unreserve_and_mod_sb()
689 if ((tp->t_frextents_delta != 0) && in xfs_trans_unreserve_and_mod_sb()
690 (tp->t_flags & XFS_TRANS_SB_DIRTY)) in xfs_trans_unreserve_and_mod_sb()
691 rtxdelta += tp->t_frextents_delta; in xfs_trans_unreserve_and_mod_sb()
702 (tp->t_flags & XFS_TRANS_SB_DIRTY)) { in xfs_trans_unreserve_and_mod_sb()
703 if (tp->t_icount_delta != 0) { in xfs_trans_unreserve_and_mod_sb()
705 msbp->msb_delta = tp->t_icount_delta; in xfs_trans_unreserve_and_mod_sb()
708 if (tp->t_ifree_delta != 0) { in xfs_trans_unreserve_and_mod_sb()
710 msbp->msb_delta = tp->t_ifree_delta; in xfs_trans_unreserve_and_mod_sb()
715 if (tp->t_flags & XFS_TRANS_SB_DIRTY) { in xfs_trans_unreserve_and_mod_sb()
716 if (tp->t_dblocks_delta != 0) { in xfs_trans_unreserve_and_mod_sb()
718 msbp->msb_delta = tp->t_dblocks_delta; in xfs_trans_unreserve_and_mod_sb()
721 if (tp->t_agcount_delta != 0) { in xfs_trans_unreserve_and_mod_sb()
723 msbp->msb_delta = tp->t_agcount_delta; in xfs_trans_unreserve_and_mod_sb()
726 if (tp->t_imaxpct_delta != 0) { in xfs_trans_unreserve_and_mod_sb()
728 msbp->msb_delta = tp->t_imaxpct_delta; in xfs_trans_unreserve_and_mod_sb()
731 if (tp->t_rextsize_delta != 0) { in xfs_trans_unreserve_and_mod_sb()
733 msbp->msb_delta = tp->t_rextsize_delta; in xfs_trans_unreserve_and_mod_sb()
736 if (tp->t_rbmblocks_delta != 0) { in xfs_trans_unreserve_and_mod_sb()
738 msbp->msb_delta = tp->t_rbmblocks_delta; in xfs_trans_unreserve_and_mod_sb()
741 if (tp->t_rblocks_delta != 0) { in xfs_trans_unreserve_and_mod_sb()
743 msbp->msb_delta = tp->t_rblocks_delta; in xfs_trans_unreserve_and_mod_sb()
746 if (tp->t_rextents_delta != 0) { in xfs_trans_unreserve_and_mod_sb()
748 msbp->msb_delta = tp->t_rextents_delta; in xfs_trans_unreserve_and_mod_sb()
751 if (tp->t_rextslog_delta != 0) { in xfs_trans_unreserve_and_mod_sb()
753 msbp->msb_delta = tp->t_rextslog_delta; in xfs_trans_unreserve_and_mod_sb()
762 error = xfs_mod_incore_sb_batch(tp->t_mountp, msb, in xfs_trans_unreserve_and_mod_sb()
786 xfs_trans_t *tp, in _xfs_trans_commit() argument
810 ASSERT(tp->t_flags & XFS_TRANS_PERM_LOG_RES); in _xfs_trans_commit()
815 mp = tp->t_mountp; in _xfs_trans_commit()
826 if (!(tp->t_flags & XFS_TRANS_DIRTY) || shutdown) { in _xfs_trans_commit()
827 xfs_trans_unreserve_and_mod_sb(tp); in _xfs_trans_commit()
834 XFS_TRANS_UNRESERVE_AND_MOD_DQUOTS(mp, tp); in _xfs_trans_commit()
835 if (tp->t_ticket) { in _xfs_trans_commit()
836 commit_lsn = xfs_log_done(mp, tp->t_ticket, in _xfs_trans_commit()
841 current_restore_flags_nested(&tp->t_pflags, PF_FSTRANS); in _xfs_trans_commit()
842 xfs_trans_free_items(tp, shutdown? XFS_TRANS_ABORT : 0); in _xfs_trans_commit()
843 xfs_trans_free_busy(tp); in _xfs_trans_commit()
844 xfs_trans_free(tp); in _xfs_trans_commit()
848 ASSERT(tp->t_ticket != NULL); in _xfs_trans_commit()
853 if (tp->t_flags & XFS_TRANS_SB_DIRTY) { in _xfs_trans_commit()
854 xfs_trans_apply_sb_deltas(tp); in _xfs_trans_commit()
856 XFS_TRANS_APPLY_DQUOT_DELTAS(mp, tp); in _xfs_trans_commit()
864 nvec = xfs_trans_count_vecs(tp); in _xfs_trans_commit()
880 xfs_trans_fill_vecs(tp, log_vector); in _xfs_trans_commit()
882 error = xfs_log_write(mp, log_vector, nvec, tp->t_ticket, &(tp->t_lsn)); in _xfs_trans_commit()
889 commit_lsn = xfs_log_done(mp, tp->t_ticket, &commit_iclog, log_flags); in _xfs_trans_commit()
891 tp->t_commit_lsn = commit_lsn; in _xfs_trans_commit()
901 current_restore_flags_nested(&tp->t_pflags, PF_FSTRANS); in _xfs_trans_commit()
902 xfs_trans_uncommit(tp, flags|XFS_TRANS_ABORT); in _xfs_trans_commit()
912 xfs_trans_unreserve_and_mod_sb(tp); in _xfs_trans_commit()
914 sync = tp->t_flags & XFS_TRANS_SYNC; in _xfs_trans_commit()
928 tp->t_logcb.cb_func = (void(*)(void*, int))xfs_trans_committed; in _xfs_trans_commit()
929 tp->t_logcb.cb_arg = tp; in _xfs_trans_commit()
938 shutdown = xfs_log_notify(mp, commit_iclog, &(tp->t_logcb)); in _xfs_trans_commit()
943 current_restore_flags_nested(&tp->t_pflags, PF_FSTRANS); in _xfs_trans_commit()
958 xfs_trans_unlock_items(tp, commit_lsn); in _xfs_trans_commit()
971 xfs_trans_committed(tp, XFS_LI_ABORTED); in _xfs_trans_commit()
1007 xfs_trans_t *tp) in xfs_trans_count_vecs() argument
1013 lidp = xfs_trans_first_item(tp); in xfs_trans_count_vecs()
1028 lidp = xfs_trans_next_item(tp, lidp); in xfs_trans_count_vecs()
1033 lidp = xfs_trans_next_item(tp, lidp); in xfs_trans_count_vecs()
1045 xfs_trans_t *tp, in xfs_trans_uncommit() argument
1050 for (lidp = xfs_trans_first_item(tp); in xfs_trans_uncommit()
1052 lidp = xfs_trans_next_item(tp, lidp)) { in xfs_trans_uncommit()
1057 IOP_UNPIN_REMOVE(lidp->lid_item, tp); in xfs_trans_uncommit()
1060 xfs_trans_unreserve_and_mod_sb(tp); in xfs_trans_uncommit()
1061 XFS_TRANS_UNRESERVE_AND_MOD_DQUOTS(tp->t_mountp, tp); in xfs_trans_uncommit()
1063 xfs_trans_free_items(tp, flags); in xfs_trans_uncommit()
1064 xfs_trans_free_busy(tp); in xfs_trans_uncommit()
1065 xfs_trans_free(tp); in xfs_trans_uncommit()
1079 xfs_trans_t *tp, in xfs_trans_fill_vecs() argument
1093 lidp = xfs_trans_first_item(tp); in xfs_trans_fill_vecs()
1100 lidp = xfs_trans_next_item(tp, lidp); in xfs_trans_fill_vecs()
1114 lidp = xfs_trans_next_item(tp, lidp); in xfs_trans_fill_vecs()
1121 tp->t_header.th_magic = XFS_TRANS_HEADER_MAGIC; in xfs_trans_fill_vecs()
1122 tp->t_header.th_type = tp->t_type; in xfs_trans_fill_vecs()
1123 tp->t_header.th_num_items = nitems; in xfs_trans_fill_vecs()
1124 log_vector->i_addr = (xfs_caddr_t)&tp->t_header; in xfs_trans_fill_vecs()
1140 xfs_trans_t *tp, in xfs_trans_cancel() argument
1150 xfs_mount_t *mp = tp->t_mountp; in xfs_trans_cancel()
1156 if ((flags & XFS_TRANS_ABORT) && !(tp->t_flags & XFS_TRANS_DIRTY)) in xfs_trans_cancel()
1163 if ((tp->t_flags & XFS_TRANS_DIRTY) && !XFS_FORCED_SHUTDOWN(mp)) { in xfs_trans_cancel()
1169 licp = &(tp->t_items); in xfs_trans_cancel()
1185 xfs_trans_unreserve_and_mod_sb(tp); in xfs_trans_cancel()
1186 XFS_TRANS_UNRESERVE_AND_MOD_DQUOTS(mp, tp); in xfs_trans_cancel()
1188 if (tp->t_ticket) { in xfs_trans_cancel()
1190 ASSERT(tp->t_flags & XFS_TRANS_PERM_LOG_RES); in xfs_trans_cancel()
1195 xfs_log_done(mp, tp->t_ticket, NULL, log_flags); in xfs_trans_cancel()
1199 current_restore_flags_nested(&tp->t_pflags, PF_FSTRANS); in xfs_trans_cancel()
1201 xfs_trans_free_items(tp, flags); in xfs_trans_cancel()
1202 xfs_trans_free_busy(tp); in xfs_trans_cancel()
1203 xfs_trans_free(tp); in xfs_trans_cancel()
1213 xfs_trans_t *tp) in xfs_trans_free() argument
1215 atomic_dec(&tp->t_mountp->m_active_trans); in xfs_trans_free()
1216 XFS_TRANS_FREE_DQINFO(tp->t_mountp, tp); in xfs_trans_free()
1217 kmem_zone_free(xfs_trans_zone, tp); in xfs_trans_free()
1305 xfs_trans_t *tp, in xfs_trans_committed() argument
1318 if (tp->t_callback != NULL) { in xfs_trans_committed()
1319 tp->t_callback(tp, tp->t_callarg); in xfs_trans_committed()
1325 licp = &(tp->t_items); in xfs_trans_committed()
1327 xfs_trans_chunk_committed(licp, tp->t_lsn, abortflag); in xfs_trans_committed()
1336 xfs_trans_chunk_committed(licp, tp->t_lsn, abortflag); in xfs_trans_committed()
1345 lbcp = &tp->t_busy; in xfs_trans_committed()
1349 xfs_alloc_clear_busy(tp, lbsp->lbc_ag, in xfs_trans_committed()
1355 xfs_trans_free_busy(tp); in xfs_trans_committed()
1360 xfs_trans_free(tp); in xfs_trans_committed()