Lines Matching +full:block +full:- +full:size

1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
47 * will be changed in a transaction. size is used to tell how many
53 uint size) in xfs_calc_buf_res() argument
55 return nbufs * (size + xfs_buf_log_overhead()); in xfs_calc_buf_res()
59 * Per-extent log reservation for the btree changes involved in freeing or
64 * num trees * ((2 blocks/level * max depth) - 1)
75 blocks = num_ops * 2 * (2 * mp->m_alloc_maxlevels - 1); in xfs_allocfree_block_count()
77 blocks += num_ops * (2 * mp->m_rmap_maxlevels - 1); in xfs_allocfree_block_count()
83 * Per-extent log reservation for refcount btree changes. These are never done
92 return num_ops * (2 * mp->m_refc_maxlevels - 1); in xfs_refcountbt_block_count()
100 * Case in point - btree format forks in memory format use more space than the
101 * on-disk format. In memory, the buffer contains a normal btree block header so
108 * amount of information we actually log is greater than the size of the inode
112 * - 4 log op headers for object
113 * - for the ilf, the inode core and 2 forks
114 * - inode log format object
115 * - the inode core
116 * - two inode forks containing bmap btree root blocks.
117 * - the btree data contained by both forks will fit into the inode size,
119 * actual inode size.
120 * - the BMBT headers need to be accounted separately, as they are
132 mp->m_sb.sb_inodesize + in xfs_calc_inode_res()
142 * the allocation btrees: 2 trees * (max depth - 1) * block size
150 return xfs_calc_buf_res(M_IGEO(mp)->inobt_maxlevels, in xfs_calc_inobt_res()
165 * traditional inobt: cover a full finobt shape change plus block allocation.
181 * the allocation btrees: 2 trees * (max depth - 1) * block size
184 * The size N of the inode chunk reservation depends on whether it is for
197 uint res, size = 0; in xfs_calc_inode_chunk_res() local
205 size = XFS_FSB_TO_B(mp, 1); in xfs_calc_inode_chunk_res()
208 res += xfs_calc_buf_res(M_IGEO(mp)->ialloc_blks, size); in xfs_calc_inode_chunk_res()
213 * Per-extent log reservation for the btree changes involved in freeing or
216 * extents, as well as the realtime summary block.
234 * These are based on the size of the file system block because that is what
256 * the agfs of the ags containing the blocks: nr_ops * sector size
257 * the refcount btrees: nr_ops * 1 trees * (2 * max depth - 1) * block size
269 return xfs_calc_buf_res(nr_ops, mp->m_sb.sb_sectsize) + in xfs_calc_refcountbt_reservation()
276 * the inode getting the new extents: inode size
277 * the inode's bmap btree: max depth * block size
279 * the superblock free block counter: sector size
280 * the allocation btrees: 2 exts * 2 trees * (2 * max depth - 1) * block size
282 * the inode getting the new extents: inode size
283 * the inode's bmap btree: max depth * block size
285 * the superblock free block counter: sector size
287 * the realtime summary: 1 block
288 * the allocation btrees: 2 trees * (2 * max depth - 1) * block size
290 * the agfs of the ags containing the blocks: 2 * sector size
291 * the agfls of the ags containing the blocks: 2 * sector size
292 * the super block free block counter: sector size
293 * the allocation btrees: 2 exts * 2 trees * (2 * max depth - 1) * block size
306 xfs_calc_buf_res(3, mp->m_sb.sb_sectsize) + in xfs_calc_write_reservation()
313 xfs_calc_buf_res(3, mp->m_sb.sb_sectsize) + in xfs_calc_write_reservation()
320 t3 = xfs_calc_buf_res(5, mp->m_sb.sb_sectsize) + in xfs_calc_write_reservation()
327 * minimum log size, add the refcountbtree splits back to t1 and t3 and in xfs_calc_write_reservation()
357 * the inode being truncated: inode size
358 * the inode's bmap btree: (max depth + 1) * block size
360 * the agf for each of the ags: 4 * sector size
361 * the agfl for each of the ags: 4 * sector size
362 * the super block to reflect the freed blocks: sector size
364 * 4 exts * 2 trees * (2 * max depth - 1) * block size
366 * the agf for each of the ags: 2 * sector size
367 * the agfl for each of the ags: 2 * sector size
368 * the super block to reflect the freed blocks: sector size
371 * the realtime summary: 2 exts * 1 block
373 * 2 exts * 2 trees * (2 * max depth - 1) * block size
387 t2 = xfs_calc_buf_res(9, mp->m_sb.sb_sectsize) + in xfs_calc_itruncate_reservation()
391 t3 = xfs_calc_buf_res(5, mp->m_sb.sb_sectsize) + in xfs_calc_itruncate_reservation()
402 * transactions now, so to compute the minimum log size, add the in xfs_calc_itruncate_reservation()
431 xlog_calc_iovec_len(MAXNAMELEN - 1); in xfs_calc_pptr_link_overhead()
437 xlog_calc_iovec_len(MAXNAMELEN - 1); in xfs_calc_pptr_unlink_overhead()
443 xlog_calc_iovec_len(MAXNAMELEN - 1) + in xfs_calc_pptr_replace_overhead()
445 xlog_calc_iovec_len(MAXNAMELEN - 1); in xfs_calc_pptr_replace_overhead()
450 * the five inodes involved: 5 * inode size
451 * the two directory btrees: 2 * (max depth + v2) * dir block size
452 * the two directory bmap btrees: 2 * max depth * block size
455 * the agf for the ags in which the blocks live: 3 * sector size
456 * the agfl for the ags in which the blocks live: 3 * sector size
457 * the superblock for the free block count: sector size
458 * the allocation btrees: 3 exts * 2 trees * (2 * max depth - 1) * block size
477 t2 = xfs_calc_buf_res(7, mp->m_sb.sb_sectsize) + in xfs_calc_rename_reservation()
484 t3 = max(resp->tr_attrsetm.tr_logres, in xfs_calc_rename_reservation()
485 resp->tr_attrrm.tr_logres); in xfs_calc_rename_reservation()
523 * Pre-reserve enough log reservation to handle the transaction in xfs_rename_log_count()
527 ret += max(resp->tr_attrsetm.tr_logcount, in xfs_rename_log_count()
528 resp->tr_attrrm.tr_logcount); in xfs_rename_log_count()
535 * the agi hash list and counters: sector size
536 * the on disk inode before ours in the agi hash list: inode cluster size
537 * the on disk inode in the agi hash list: inode cluster size
543 return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) + in xfs_calc_iunlink_remove_reservation()
544 2 * M_IGEO(mp)->inode_cluster_size; in xfs_calc_iunlink_remove_reservation()
555 * Pre-reserve enough log reservation to handle the transaction in xfs_link_log_count()
559 ret += resp->tr_attrsetm.tr_logcount; in xfs_link_log_count()
566 * the parent directory inode: inode size
567 * the linked inode: inode size
568 * the directory btree could split: (max depth + v2) * dir block size
571 * the agf for the ag in which the blocks live: sector size
572 * the agfl for the ag in which the blocks live: sector size
573 * the superblock for the free block count: sector size
574 * the allocation btrees: 2 trees * (2 * max depth - 1) * block size
587 t2 = xfs_calc_buf_res(3, mp->m_sb.sb_sectsize) + in xfs_calc_link_reservation()
592 t3 = resp->tr_attrsetm.tr_logres; in xfs_calc_link_reservation()
601 * the agi hash list: sector size
602 * the on disk inode: inode cluster size
607 return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) + in xfs_calc_iunlink_add_reservation()
608 M_IGEO(mp)->inode_cluster_size; in xfs_calc_iunlink_add_reservation()
619 * Pre-reserve enough log reservation to handle the transaction in xfs_remove_log_count()
623 ret += resp->tr_attrrm.tr_logcount; in xfs_remove_log_count()
630 * the parent directory inode: inode size
631 * the removed inode: inode size
632 * the directory btree could join: (max depth + v2) * dir block size
635 * the agf for the ag in which the blocks live: 2 * sector size
636 * the agfl for the ag in which the blocks live: 2 * sector size
637 * the superblock for the free block count: sector size
638 * the allocation btrees: 2 exts * 2 trees * (2 * max depth - 1) * block size
652 t2 = xfs_calc_buf_res(4, mp->m_sb.sb_sectsize) + in xfs_calc_remove_reservation()
657 t3 = resp->tr_attrrm.tr_logres; in xfs_calc_remove_reservation()
666 * covers. We start with the modify case - allocation done by modification
667 * of the state of existing inodes - and the allocation case.
672 * the parent directory inode: inode size
673 * the new inode: inode size
674 * the inode btree entry: block size
675 * the superblock for the nlink flag: sector size
676 * the directory btree: (max depth + v2) * dir block size
677 * the directory inode's bmap btree: (max depth + v2) * block size
685 xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) + in xfs_calc_create_resv_modify()
694 * the superblock for the nlink flag: sector size
703 return xfs_calc_buf_res(2, mp->m_sb.sb_sectsize) + in xfs_calc_icreate_resv_alloc()
704 mp->m_sb.sb_sectsize + in xfs_calc_icreate_resv_alloc()
718 * Pre-reserve enough log reservation to handle the transaction in xfs_icreate_log_count()
722 ret += resp->tr_attrsetm.tr_logcount; in xfs_icreate_log_count()
739 t3 = resp->tr_attrsetm.tr_logres; in xfs_calc_icreate_reservation()
764 * Pre-reserve enough log reservation to handle the transaction in xfs_mkdir_log_count()
768 ret += resp->tr_attrsetm.tr_logcount; in xfs_mkdir_log_count()
791 * Pre-reserve enough log reservation to handle the transaction in xfs_symlink_log_count()
795 ret += resp->tr_attrsetm.tr_logcount; in xfs_symlink_log_count()
815 * the inode being freed: inode size
816 * the super block free inode counter, AGF and AGFL: sector size
834 xfs_calc_buf_res(3, mp->m_sb.sb_sectsize) + in xfs_calc_ifree_reservation()
851 xfs_calc_buf_res(1, mp->m_sb.sb_sectsize); in xfs_calc_ichange_reservation()
865 return xfs_calc_buf_res(3, mp->m_sb.sb_sectsize) + in xfs_calc_growdata_reservation()
874 * superblock: sector size
875 * agf of the ag from which the extent is allocated: sector size
877 * bitmap/summary inode: inode size
878 * allocation btrees for 1 block alloc: 2 * (2 * maxdepth - 1) * blocksize
884 return xfs_calc_buf_res(2, mp->m_sb.sb_sectsize) + in xfs_calc_growrtalloc_reservation()
895 * one bitmap/summary block: blocksize
901 return xfs_calc_buf_res(1, mp->m_sb.sb_blocksize); in xfs_calc_growrtzero_reservation()
908 * superblock: sector size
909 * bitmap inode: inode size
910 * summary inode: inode size
911 * one bitmap block: blocksize
912 * summary blocks: new summary size
918 return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) + in xfs_calc_growrtfree_reservation()
920 xfs_calc_buf_res(1, mp->m_sb.sb_blocksize) + in xfs_calc_growrtfree_reservation()
921 xfs_calc_buf_res(1, XFS_FSB_TO_B(mp, mp->m_rsumblocks)); in xfs_calc_growrtfree_reservation()
947 * Converting the inode from non-attributed to attributed.
948 * the inode being converted: inode size
949 * agf block and superblock (for block allocation)
950 * the new block (directory sized)
951 * bmap blocks for the new directory block
960 xfs_calc_buf_res(2, mp->m_sb.sb_sectsize) + in xfs_calc_addafork_reservation()
961 xfs_calc_buf_res(1, mp->m_dir_geo->blksize) + in xfs_calc_addafork_reservation()
970 * the inode being truncated: inode size
971 * the inode's bmap btree: max depth * block size
973 * the agf for each of the ags: 4 * sector size
974 * the agfl for each of the ags: 4 * sector size
975 * the super block to reflect the freed blocks: sector size
977 * 4 exts * 2 trees * (2 * max depth - 1) * block size
986 (xfs_calc_buf_res(9, mp->m_sb.sb_sectsize) + in xfs_calc_attrinval_reservation()
998 * Since attribute transaction space is dependent on the size of the attribute,
1008 xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) + in xfs_calc_attrsetm_reservation()
1013 * Setting an attribute at runtime, transaction space unit per block.
1014 * the superblock for allocations: sector size
1015 * the inode bmap btree could join or split: max depth * block size
1018 * one block so that the caller could figure out the total space according
1020 * ext * M_RES(mp)->tr_attrsetrt.tr_logres
1026 return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) + in xfs_calc_attrsetrt_reservation()
1033 * the inode: inode size
1034 * the attribute btree could join: max depth * block size
1035 * the inode bmap btree could join or split: max depth * block size
1037 * the agf for the ag in which the blocks live: 2 * sector size
1038 * the agfl for the ag in which the blocks live: 2 * sector size
1039 * the superblock for the free block count: sector size
1040 * the allocation btrees: 2 exts * 2 trees * (2 * max depth - 1) * block size
1053 (xfs_calc_buf_res(5, mp->m_sb.sb_sectsize) + in xfs_calc_attrrm_reservation()
1065 return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize); in xfs_calc_clear_agi_bucket_reservation()
1081 * the unit of quota allocation: one system block size
1090 XFS_FSB_TO_B(mp, XFS_DQUOT_CLUSTER_SIZE_FSB) - 1); in xfs_calc_qm_dqalloc_reservation()
1101 * Syncing the incore super block changes to disk.
1102 * the super block to reflect the changes: sector size
1108 return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize); in xfs_calc_sb_reservation()
1121 * reservation will have to be modified by the size of the attributes being
1130 ASSERT(resp->tr_attrsetm.tr_logres > 0); in xfs_calc_namespace_reservations()
1132 resp->tr_rename.tr_logres = xfs_calc_rename_reservation(mp); in xfs_calc_namespace_reservations()
1133 resp->tr_rename.tr_logcount = xfs_rename_log_count(mp, resp); in xfs_calc_namespace_reservations()
1134 resp->tr_rename.tr_logflags |= XFS_TRANS_PERM_LOG_RES; in xfs_calc_namespace_reservations()
1136 resp->tr_link.tr_logres = xfs_calc_link_reservation(mp); in xfs_calc_namespace_reservations()
1137 resp->tr_link.tr_logcount = xfs_link_log_count(mp, resp); in xfs_calc_namespace_reservations()
1138 resp->tr_link.tr_logflags |= XFS_TRANS_PERM_LOG_RES; in xfs_calc_namespace_reservations()
1140 resp->tr_remove.tr_logres = xfs_calc_remove_reservation(mp); in xfs_calc_namespace_reservations()
1141 resp->tr_remove.tr_logcount = xfs_remove_log_count(mp, resp); in xfs_calc_namespace_reservations()
1142 resp->tr_remove.tr_logflags |= XFS_TRANS_PERM_LOG_RES; in xfs_calc_namespace_reservations()
1144 resp->tr_symlink.tr_logres = xfs_calc_symlink_reservation(mp); in xfs_calc_namespace_reservations()
1145 resp->tr_symlink.tr_logcount = xfs_symlink_log_count(mp, resp); in xfs_calc_namespace_reservations()
1146 resp->tr_symlink.tr_logflags |= XFS_TRANS_PERM_LOG_RES; in xfs_calc_namespace_reservations()
1148 resp->tr_create.tr_logres = xfs_calc_icreate_reservation(mp); in xfs_calc_namespace_reservations()
1149 resp->tr_create.tr_logcount = xfs_icreate_log_count(mp, resp); in xfs_calc_namespace_reservations()
1150 resp->tr_create.tr_logflags |= XFS_TRANS_PERM_LOG_RES; in xfs_calc_namespace_reservations()
1152 resp->tr_mkdir.tr_logres = xfs_calc_mkdir_reservation(mp); in xfs_calc_namespace_reservations()
1153 resp->tr_mkdir.tr_logcount = xfs_mkdir_log_count(mp, resp); in xfs_calc_namespace_reservations()
1154 resp->tr_mkdir.tr_logflags |= XFS_TRANS_PERM_LOG_RES; in xfs_calc_namespace_reservations()
1168 resp->tr_write.tr_logres = xfs_calc_write_reservation(mp, false); in xfs_trans_resv_calc()
1169 resp->tr_write.tr_logcount = XFS_WRITE_LOG_COUNT; in xfs_trans_resv_calc()
1170 resp->tr_write.tr_logflags |= XFS_TRANS_PERM_LOG_RES; in xfs_trans_resv_calc()
1172 resp->tr_itruncate.tr_logres = xfs_calc_itruncate_reservation(mp, false); in xfs_trans_resv_calc()
1173 resp->tr_itruncate.tr_logcount = XFS_ITRUNCATE_LOG_COUNT; in xfs_trans_resv_calc()
1174 resp->tr_itruncate.tr_logflags |= XFS_TRANS_PERM_LOG_RES; in xfs_trans_resv_calc()
1176 resp->tr_create_tmpfile.tr_logres = in xfs_trans_resv_calc()
1178 resp->tr_create_tmpfile.tr_logcount = XFS_CREATE_TMPFILE_LOG_COUNT; in xfs_trans_resv_calc()
1179 resp->tr_create_tmpfile.tr_logflags |= XFS_TRANS_PERM_LOG_RES; in xfs_trans_resv_calc()
1181 resp->tr_ifree.tr_logres = xfs_calc_ifree_reservation(mp); in xfs_trans_resv_calc()
1182 resp->tr_ifree.tr_logcount = XFS_INACTIVE_LOG_COUNT; in xfs_trans_resv_calc()
1183 resp->tr_ifree.tr_logflags |= XFS_TRANS_PERM_LOG_RES; in xfs_trans_resv_calc()
1185 resp->tr_addafork.tr_logres = xfs_calc_addafork_reservation(mp); in xfs_trans_resv_calc()
1186 resp->tr_addafork.tr_logcount = XFS_ADDAFORK_LOG_COUNT; in xfs_trans_resv_calc()
1187 resp->tr_addafork.tr_logflags |= XFS_TRANS_PERM_LOG_RES; in xfs_trans_resv_calc()
1189 resp->tr_attrinval.tr_logres = xfs_calc_attrinval_reservation(mp); in xfs_trans_resv_calc()
1190 resp->tr_attrinval.tr_logcount = XFS_ATTRINVAL_LOG_COUNT; in xfs_trans_resv_calc()
1191 resp->tr_attrinval.tr_logflags |= XFS_TRANS_PERM_LOG_RES; in xfs_trans_resv_calc()
1193 resp->tr_attrsetm.tr_logres = xfs_calc_attrsetm_reservation(mp); in xfs_trans_resv_calc()
1194 resp->tr_attrsetm.tr_logcount = XFS_ATTRSET_LOG_COUNT; in xfs_trans_resv_calc()
1195 resp->tr_attrsetm.tr_logflags |= XFS_TRANS_PERM_LOG_RES; in xfs_trans_resv_calc()
1197 resp->tr_attrrm.tr_logres = xfs_calc_attrrm_reservation(mp); in xfs_trans_resv_calc()
1198 resp->tr_attrrm.tr_logcount = XFS_ATTRRM_LOG_COUNT; in xfs_trans_resv_calc()
1199 resp->tr_attrrm.tr_logflags |= XFS_TRANS_PERM_LOG_RES; in xfs_trans_resv_calc()
1201 resp->tr_growrtalloc.tr_logres = xfs_calc_growrtalloc_reservation(mp); in xfs_trans_resv_calc()
1202 resp->tr_growrtalloc.tr_logcount = XFS_DEFAULT_PERM_LOG_COUNT; in xfs_trans_resv_calc()
1203 resp->tr_growrtalloc.tr_logflags |= XFS_TRANS_PERM_LOG_RES; in xfs_trans_resv_calc()
1205 resp->tr_qm_dqalloc.tr_logres = xfs_calc_qm_dqalloc_reservation(mp, in xfs_trans_resv_calc()
1207 resp->tr_qm_dqalloc.tr_logcount = XFS_WRITE_LOG_COUNT; in xfs_trans_resv_calc()
1208 resp->tr_qm_dqalloc.tr_logflags |= XFS_TRANS_PERM_LOG_RES; in xfs_trans_resv_calc()
1216 resp->tr_qm_setqlim.tr_logres = xfs_calc_qm_setqlim_reservation(); in xfs_trans_resv_calc()
1217 resp->tr_qm_setqlim.tr_logcount = XFS_DEFAULT_LOG_COUNT; in xfs_trans_resv_calc()
1219 resp->tr_sb.tr_logres = xfs_calc_sb_reservation(mp); in xfs_trans_resv_calc()
1220 resp->tr_sb.tr_logcount = XFS_DEFAULT_LOG_COUNT; in xfs_trans_resv_calc()
1223 resp->tr_growdata.tr_logres = xfs_calc_growdata_reservation(mp); in xfs_trans_resv_calc()
1224 resp->tr_growdata.tr_logcount = XFS_DEFAULT_PERM_LOG_COUNT; in xfs_trans_resv_calc()
1225 resp->tr_growdata.tr_logflags |= XFS_TRANS_PERM_LOG_RES; in xfs_trans_resv_calc()
1228 resp->tr_ichange.tr_logres = xfs_calc_ichange_reservation(mp); in xfs_trans_resv_calc()
1229 resp->tr_fsyncts.tr_logres = xfs_calc_swrite_reservation(mp); in xfs_trans_resv_calc()
1230 resp->tr_writeid.tr_logres = xfs_calc_writeid_reservation(mp); in xfs_trans_resv_calc()
1231 resp->tr_attrsetrt.tr_logres = xfs_calc_attrsetrt_reservation(mp); in xfs_trans_resv_calc()
1232 resp->tr_clearagi.tr_logres = xfs_calc_clear_agi_bucket_reservation(mp); in xfs_trans_resv_calc()
1233 resp->tr_growrtzero.tr_logres = xfs_calc_growrtzero_reservation(mp); in xfs_trans_resv_calc()
1234 resp->tr_growrtfree.tr_logres = xfs_calc_growrtfree_reservation(mp); in xfs_trans_resv_calc()
1248 resp->tr_itruncate.tr_logcount += logcount_adj; in xfs_trans_resv_calc()
1249 resp->tr_write.tr_logcount += logcount_adj; in xfs_trans_resv_calc()
1250 resp->tr_qm_dqalloc.tr_logcount += logcount_adj; in xfs_trans_resv_calc()