88 MAX((mp->m_sb.sb_inodesize +
90 2 * mp->m_sb.sb_sectsize +
91 mp->m_sb.sb_sectsize +
95 (2 * mp->m_sb.sb_sectsize +
96 2 * mp->m_sb.sb_sectsize +
97 mp->m_sb.sb_sectsize +
117 struct xfs_mount *
mp)
120 MAX((mp->m_sb.sb_inodesize +
123 (4 * mp->m_sb.sb_sectsize +
124 4 * mp->m_sb.sb_sectsize +
125 mp->m_sb.sb_sectsize +
148 struct xfs_mount *
mp)
151 MAX((4 * mp->m_sb.sb_inodesize +
154 (3 * mp->m_sb.sb_sectsize +
155 3 * mp->m_sb.sb_sectsize +
156 mp->m_sb.sb_sectsize +
175 struct xfs_mount *
mp)
178 MAX((mp->m_sb.sb_inodesize +
179 mp->m_sb.sb_inodesize +
182 (mp->m_sb.sb_sectsize +
183 mp->m_sb.sb_sectsize +
184 mp->m_sb.sb_sectsize +
203 struct xfs_mount *
mp)
206 MAX((mp->m_sb.sb_inodesize +
207 mp->m_sb.sb_inodesize +
210 (2 * mp->m_sb.sb_sectsize +
211 2 * mp->m_sb.sb_sectsize +
212 mp->m_sb.sb_sectsize +
233 struct xfs_mount *
mp)
236 MAX((mp->m_sb.sb_inodesize +
237 mp->m_sb.sb_inodesize +
242 (2 * mp->m_sb.sb_sectsize +
267 struct xfs_mount *
mp)
270 MAX((mp->m_sb.sb_inodesize +
271 mp->m_sb.sb_inodesize +
272 mp->m_sb.sb_sectsize +
276 (3 * mp->m_sb.sb_sectsize +
289 struct xfs_mount *
mp)
306 struct xfs_mount *
mp)
309 mp->m_sb.sb_inodesize +
310 mp->m_sb.sb_sectsize +
311 mp->m_sb.sb_sectsize +
327 struct xfs_mount *
mp)
330 mp->m_sb.sb_inodesize +
331 mp->m_sb.sb_sectsize +
344 struct xfs_mount *
mp)
346 return mp->m_sb.sb_sectsize * 3 +
363 struct xfs_mount *
mp)
365 return 2 * mp->m_sb.sb_sectsize +
367 mp->m_sb.sb_inodesize +
380 struct xfs_mount *
mp)
382 return mp->m_sb.sb_blocksize + 128;
397 struct xfs_mount *
mp)
399 return mp->m_sb.sb_sectsize +
400 2 * mp->m_sb.sb_inodesize +
401 mp->m_sb.sb_blocksize +
412 struct xfs_mount *
mp)
414 return mp->m_sb.sb_inodesize + 128;
424 return mp->m_sb.sb_inodesize + 128;
437 struct xfs_mount *
mp)
440 mp->m_sb.sb_inodesize +
441 mp->m_sb.sb_sectsize * 2 +
462 struct xfs_mount *
mp)
464 return MAX((mp->m_sb.sb_inodesize +
467 (4 * mp->m_sb.sb_sectsize +
468 4 * mp->m_sb.sb_sectsize +
469 mp->m_sb.sb_sectsize +
486 struct xfs_mount *
mp)
489 mp->m_sb.sb_inodesize +
490 mp->m_sb.sb_sectsize +
508 struct xfs_mount *
mp)
511 MAX((mp->m_sb.sb_inodesize +
516 (2 * mp->m_sb.sb_sectsize +
517 2 * mp->m_sb.sb_sectsize +
518 mp->m_sb.sb_sectsize +
528 struct xfs_mount *
mp)
530 return mp->m_sb.sb_sectsize + 128;
539 struct xfs_mount *
mp)
581 sb_start_intwrite(mp->m_super);
602 INIT_LIST_HEAD(&tp->t_items);
603 INIT_LIST_HEAD(&tp->t_busy);
613 struct xfs_trans *tp)
615 xfs_extent_busy_sort(&tp->t_busy);
620 sb_end_intwrite(tp->t_mountp->m_super);
645 ntp->t_type = tp->t_type;
646 ntp->t_mountp = tp->t_mountp;
647 INIT_LIST_HEAD(&ntp->t_items);
648 INIT_LIST_HEAD(&ntp->t_busy);
659 ntp->t_blk_res = tp->t_blk_res - tp->t_blk_res_used;
660 tp->t_blk_res = tp->t_blk_res_used;
661 ntp->t_rtx_res = tp->t_rtx_res - tp->t_rtx_res_used;
662 tp->t_rtx_res = tp->t_rtx_res_used;
663 ntp->t_pflags = tp->t_pflags;
707 -((int64_t)blocks), rsvd);
712 tp->t_blk_res += blocks;
719 bool permanent =
false;
721 ASSERT(tp->t_log_res == 0 || tp->t_log_res == logspace);
722 ASSERT(tp->t_log_count == 0 || tp->t_log_count == logcount);
729 ASSERT(!(tp->t_flags & XFS_TRANS_PERM_LOG_RES));
732 if (tp->t_ticket !=
NULL) {
733 ASSERT(flags & XFS_TRANS_PERM_LOG_RES);
737 logcount, &tp->t_ticket,
745 tp->t_log_res = logspace;
746 tp->t_log_count = logcount;
756 -((int64_t)rtextents), rsvd);
761 tp->t_rtx_res += rtextents;
775 log_flags = XFS_LOG_REL_PERM_RESERV;
782 tp->t_flags &= ~XFS_TRANS_PERM_LOG_RES;
788 (int64_t)blocks, rsvd);
820 xfs_mount_t *
mp = tp->t_mountp;
824 tp->t_icount_delta +=
delta;
825 if (xfs_sb_version_haslazysbcount(&mp->m_sb))
829 tp->t_ifree_delta +=
delta;
830 if (xfs_sb_version_haslazysbcount(&mp->m_sb))
840 tp->t_blk_res_used += (
uint)-delta;
841 ASSERT(tp->t_blk_res_used <= tp->t_blk_res);
843 tp->t_fdblocks_delta +=
delta;
844 if (xfs_sb_version_haslazysbcount(&mp->m_sb))
854 tp->t_res_fdblocks_delta +=
delta;
855 if (xfs_sb_version_haslazysbcount(&mp->m_sb))
865 tp->t_rtx_res_used += (
uint)-delta;
866 ASSERT(tp->t_rtx_res_used <= tp->t_rtx_res);
868 tp->t_frextents_delta +=
delta;
877 tp->t_res_frextents_delta +=
delta;
881 tp->t_dblocks_delta +=
delta;
885 tp->t_agcount_delta +=
delta;
888 tp->t_imaxpct_delta +=
delta;
891 tp->t_rextsize_delta +=
delta;
894 tp->t_rbmblocks_delta +=
delta;
897 tp->t_rblocks_delta +=
delta;
900 tp->t_rextents_delta +=
delta;
903 tp->t_rextslog_delta +=
delta;
910 tp->t_flags |=
flags;
935 ASSERT((tp->t_fdblocks_delta + tp->t_res_fdblocks_delta) ==
936 (tp->t_ag_freeblks_delta + tp->t_ag_flist_delta +
937 tp->t_ag_btree_delta));
942 if (!xfs_sb_version_haslazysbcount(&(tp->t_mountp->m_sb))) {
943 if (tp->t_icount_delta)
944 be64_add_cpu(&sbp->
sb_icount, tp->t_icount_delta);
945 if (tp->t_ifree_delta)
946 be64_add_cpu(&sbp->
sb_ifree, tp->t_ifree_delta);
947 if (tp->t_fdblocks_delta)
948 be64_add_cpu(&sbp->
sb_fdblocks, tp->t_fdblocks_delta);
949 if (tp->t_res_fdblocks_delta)
950 be64_add_cpu(&sbp->
sb_fdblocks, tp->t_res_fdblocks_delta);
953 if (tp->t_frextents_delta)
954 be64_add_cpu(&sbp->
sb_frextents, tp->t_frextents_delta);
955 if (tp->t_res_frextents_delta)
956 be64_add_cpu(&sbp->
sb_frextents, tp->t_res_frextents_delta);
958 if (tp->t_dblocks_delta) {
959 be64_add_cpu(&sbp->
sb_dblocks, tp->t_dblocks_delta);
962 if (tp->t_agcount_delta) {
963 be32_add_cpu(&sbp->
sb_agcount, tp->t_agcount_delta);
966 if (tp->t_imaxpct_delta) {
970 if (tp->t_rextsize_delta) {
971 be32_add_cpu(&sbp->
sb_rextsize, tp->t_rextsize_delta);
974 if (tp->t_rbmblocks_delta) {
975 be32_add_cpu(&sbp->
sb_rbmblocks, tp->t_rbmblocks_delta);
978 if (tp->t_rblocks_delta) {
979 be64_add_cpu(&sbp->
sb_rblocks, tp->t_rblocks_delta);
982 if (tp->t_rextents_delta) {
983 be64_add_cpu(&sbp->
sb_rextents, tp->t_rextents_delta);
986 if (tp->t_rextslog_delta) {
1029 xfs_mod_sb_t
msb[9];
1031 xfs_mount_t *
mp = tp->t_mountp;
1035 int64_t blkdelta = 0;
1036 int64_t rtxdelta = 0;
1038 int64_t ifreedelta = 0;
1044 if (tp->t_blk_res > 0)
1045 blkdelta = tp->t_blk_res;
1046 if ((tp->t_fdblocks_delta != 0) &&
1047 (xfs_sb_version_haslazysbcount(&mp->m_sb) ||
1049 blkdelta += tp->t_fdblocks_delta;
1051 if (tp->t_rtx_res > 0)
1052 rtxdelta = tp->t_rtx_res;
1053 if ((tp->t_frextents_delta != 0) &&
1055 rtxdelta += tp->t_frextents_delta;
1057 if (xfs_sb_version_haslazysbcount(&mp->m_sb) ||
1059 idelta = tp->t_icount_delta;
1060 ifreedelta = tp->t_ifree_delta;
1075 goto out_undo_fdblocks;
1082 goto out_undo_icount;
1086 if (rtxdelta != 0) {
1088 msbp->msb_delta = rtxdelta;
1093 if (tp->t_dblocks_delta != 0) {
1095 msbp->msb_delta = tp->t_dblocks_delta;
1098 if (tp->t_agcount_delta != 0) {
1100 msbp->msb_delta = tp->t_agcount_delta;
1103 if (tp->t_imaxpct_delta != 0) {
1105 msbp->msb_delta = tp->t_imaxpct_delta;
1108 if (tp->t_rextsize_delta != 0) {
1110 msbp->msb_delta = tp->t_rextsize_delta;
1113 if (tp->t_rbmblocks_delta != 0) {
1115 msbp->msb_delta = tp->t_rbmblocks_delta;
1118 if (tp->t_rblocks_delta != 0) {
1120 msbp->msb_delta = tp->t_rblocks_delta;
1123 if (tp->t_rextents_delta != 0) {
1125 msbp->msb_delta = tp->t_rextents_delta;
1128 if (tp->t_rextslog_delta != 0) {
1130 msbp->msb_delta = tp->t_rextslog_delta;
1140 (
uint)(msbp - msb), rsvd);
1142 goto out_undo_ifreecount;
1147 out_undo_ifreecount:
1149 xfs_icsb_modify_counters(mp,
XFS_SBS_IFREE, -ifreedelta, rsvd);
1168 struct xfs_trans *tp,
1169 struct xfs_log_item *
lip)
1173 ASSERT(lip->li_mountp == tp->t_mountp);
1174 ASSERT(lip->li_ailp == tp->t_mountp->m_ail);
1182 lip->li_desc = lidp;
1198 struct xfs_log_item *
lip)
1201 lip->li_desc =
NULL;
1210 struct xfs_trans *tp,
1219 lip->li_desc =
NULL;
1222 IOP_COMMITTING(lip, commit_lsn);
1224 lip->li_flags |= XFS_LI_ABORTED;
1232 xfs_log_item_batch_insert(
1235 struct xfs_log_item **log_items,
1245 for (i = 0; i < nr_items; i++)
1246 IOP_UNPIN(log_items[i], 0);
1276 #define LOG_ITEM_BATCH_SIZE 32
1287 for (lv = log_vector; lv; lv = lv->
lv_next ) {
1292 lip->li_flags |= XFS_LI_ABORTED;
1293 item_lsn = IOP_COMMITTED(lip, commit_lsn);
1296 if (XFS_LSN_CMP(item_lsn, (
xfs_lsn_t)-1) == 0)
1309 if (item_lsn != commit_lsn) {
1319 if (XFS_LSN_CMP(item_lsn, lip->li_lsn) > 0)
1320 xfs_trans_ail_update(ailp, lip, item_lsn);
1330 xfs_log_item_batch_insert(ailp, &cur, log_items,
1338 xfs_log_item_batch_insert(ailp, &cur, log_items, i, commit_lsn);
1359 struct xfs_trans *tp,
1362 struct xfs_mount *
mp = tp->t_mountp;
1374 log_flags = XFS_LOG_REL_PERM_RESERV;
1387 if (XFS_FORCED_SHUTDOWN(mp)) {
1403 xfs_force_shutdown(mp, SHUTDOWN_LOG_IO_ERROR);
1418 XFS_LOG_SYNC,
NULL);
1438 if (commit_lsn == -1 && !error)
1463 xfs_mount_t *
mp = tp->t_mountp;
1470 flags &= ~XFS_TRANS_ABORT;
1478 xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
1481 if (!(flags & XFS_TRANS_ABORT) && !XFS_FORCED_SHUTDOWN(mp)) {
1494 log_flags = XFS_LOG_REL_PERM_RESERV;
1517 struct xfs_trans **tpp,
1518 struct xfs_inode *
dp)
1520 struct xfs_trans *
trans;
1521 unsigned int logres,
count;
1533 logres = trans->t_log_res;
1534 count = trans->t_log_count;