Lines Matching +full:max +full:- +full:adj
1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
59 * Per-extent log reservation for the btree changes involved in freeing or
64 * num trees * ((2 blocks/level * max depth) - 1)
66 * Keep in mind that max depth is calculated separately for each type of tree.
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 return num_ops * (2 * mp->m_rtrefc_maxlevels - 1); in xfs_rtrefcountbt_block_count()
108 * Case in point - btree format forks in memory format use more space than the
109 * on-disk format. In memory, the buffer contains a normal btree block header so
120 * - 4 log op headers for object
121 * - for the ilf, the inode core and 2 forks
122 * - inode log format object
123 * - the inode core
124 * - two inode forks containing bmap btree root blocks.
125 * - the btree data contained by both forks will fit into the inode size,
128 * - the BMBT headers need to be accounted separately, as they are
140 mp->m_sb.sb_inodesize + in xfs_calc_inode_res()
149 * the inode btree: max depth * blocksize
150 * the allocation btrees: 2 trees * (max depth - 1) * block size
158 return xfs_calc_buf_res(M_IGEO(mp)->inobt_maxlevels, in xfs_calc_inobt_res()
189 * the allocation btrees: 2 trees * (max depth - 1) * block size
216 res += xfs_calc_buf_res(M_IGEO(mp)->ialloc_blks, size); in xfs_calc_inode_chunk_res()
221 * Per-extent log reservation for the btree changes involved in freeing or
242 t2 = num_ops * (2 * mp->m_rtrmap_maxlevels - 1); in xfs_rtalloc_block_count()
244 return max(t1, t2); in xfs_rtalloc_block_count()
270 * This is calculated as the max of:
273 * the refcount btrees: nr_ops * 1 trees * (2 * max depth - 1) * block size
276 * the rtrefcount btrees: nr_ops * 1 trees * (2 * max depth - 1) * block size
289 t1 = xfs_calc_buf_res(nr_ops, mp->m_sb.sb_sectsize) + in xfs_calc_refcountbt_reservation()
297 return max(t1, t2); in xfs_calc_refcountbt_reservation()
304 * the inode's bmap btree: max depth * block size
307 * the allocation btrees: 2 exts * 2 trees * (2 * max depth - 1) * block size
310 * the inode's bmap btree: max depth * block size
315 * the allocation btrees: 2 trees * (2 * max depth - 1) * block size
320 * the allocation btrees: 2 exts * 2 trees * (2 * max depth - 1) * block size
333 xfs_calc_buf_res(3, mp->m_sb.sb_sectsize) + in xfs_calc_write_reservation()
340 xfs_calc_buf_res(3, mp->m_sb.sb_sectsize) + in xfs_calc_write_reservation()
347 t3 = xfs_calc_buf_res(5, mp->m_sb.sb_sectsize) + in xfs_calc_write_reservation()
360 unsigned int adj = 0; in xfs_calc_write_reservation() local
363 adj = xfs_calc_buf_res( in xfs_calc_write_reservation()
366 t1 += adj; in xfs_calc_write_reservation()
367 t3 += adj; in xfs_calc_write_reservation()
372 return XFS_DQUOT_LOGRES + max(t4, max3(t1, t2, t3)); in xfs_calc_write_reservation()
385 * the inode's bmap btree: (max depth + 1) * block size
391 * 4 exts * 2 trees * (2 * max depth - 1) * block size
400 * 2 exts * 2 trees * (2 * max depth - 1) * block size
414 t2 = xfs_calc_buf_res(9, mp->m_sb.sb_sectsize) + in xfs_calc_itruncate_reservation()
418 t3 = xfs_calc_buf_res(5, mp->m_sb.sb_sectsize) + in xfs_calc_itruncate_reservation()
444 return XFS_DQUOT_LOGRES + max(t4, max3(t1, t2, t3)); in xfs_calc_itruncate_reservation()
458 xlog_calc_iovec_len(MAXNAMELEN - 1); in xfs_calc_pptr_link_overhead()
464 xlog_calc_iovec_len(MAXNAMELEN - 1); in xfs_calc_pptr_unlink_overhead()
470 xlog_calc_iovec_len(MAXNAMELEN - 1) + in xfs_calc_pptr_replace_overhead()
472 xlog_calc_iovec_len(MAXNAMELEN - 1); in xfs_calc_pptr_replace_overhead()
478 * the two directory btrees: 2 * (max depth + v2) * dir block size
479 * the two directory bmap btrees: 2 * max depth * block size
485 * the allocation btrees: 3 exts * 2 trees * (2 * max depth - 1) * block size
504 t2 = xfs_calc_buf_res(7, mp->m_sb.sb_sectsize) + in xfs_calc_rename_reservation()
511 t3 = max(resp->tr_attrsetm.tr_logres, in xfs_calc_rename_reservation()
512 resp->tr_attrrm.tr_logres); in xfs_calc_rename_reservation()
535 overhead += max(rename_overhead, exchange_overhead); in xfs_calc_rename_reservation()
550 * Pre-reserve enough log reservation to handle the transaction in xfs_rename_log_count()
554 ret += max(resp->tr_attrsetm.tr_logcount, in xfs_rename_log_count()
555 resp->tr_attrrm.tr_logcount); in xfs_rename_log_count()
570 return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) + in xfs_calc_iunlink_remove_reservation()
571 2 * M_IGEO(mp)->inode_cluster_size; in xfs_calc_iunlink_remove_reservation()
582 * Pre-reserve enough log reservation to handle the transaction in xfs_link_log_count()
586 ret += resp->tr_attrsetm.tr_logcount; in xfs_link_log_count()
595 * the directory btree could split: (max depth + v2) * dir block size
596 * the directory bmap btree could join or split: (max depth + v2) * blocksize
601 * the allocation btrees: 2 trees * (2 * max depth - 1) * block size
614 t2 = xfs_calc_buf_res(3, mp->m_sb.sb_sectsize) + in xfs_calc_link_reservation()
619 t3 = resp->tr_attrsetm.tr_logres; in xfs_calc_link_reservation()
634 return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) + in xfs_calc_iunlink_add_reservation()
635 M_IGEO(mp)->inode_cluster_size; in xfs_calc_iunlink_add_reservation()
646 * Pre-reserve enough log reservation to handle the transaction in xfs_remove_log_count()
650 ret += resp->tr_attrrm.tr_logcount; in xfs_remove_log_count()
659 * the directory btree could join: (max depth + v2) * dir block size
660 * the directory bmap btree could join or split: (max depth + v2) * blocksize
665 * the allocation btrees: 2 exts * 2 trees * (2 * max depth - 1) * block size
679 t2 = xfs_calc_buf_res(4, mp->m_sb.sb_sectsize) + in xfs_calc_remove_reservation()
684 t3 = resp->tr_attrrm.tr_logres; in xfs_calc_remove_reservation()
693 * covers. We start with the modify case - allocation done by modification
694 * of the state of existing inodes - and the allocation case.
703 * the directory btree: (max depth + v2) * dir block size
704 * the directory inode's bmap btree: (max depth + v2) * block size
712 xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) + in xfs_calc_create_resv_modify()
730 return xfs_calc_buf_res(2, mp->m_sb.sb_sectsize) + in xfs_calc_icreate_resv_alloc()
731 mp->m_sb.sb_sectsize + in xfs_calc_icreate_resv_alloc()
745 * Pre-reserve enough log reservation to handle the transaction in xfs_icreate_log_count()
749 ret += resp->tr_attrsetm.tr_logcount; in xfs_icreate_log_count()
766 t3 = resp->tr_attrsetm.tr_logres; in xfs_calc_icreate_reservation()
791 * Pre-reserve enough log reservation to handle the transaction in xfs_mkdir_log_count()
795 ret += resp->tr_attrsetm.tr_logcount; in xfs_mkdir_log_count()
818 * Pre-reserve enough log reservation to handle the transaction in xfs_symlink_log_count()
822 ret += resp->tr_attrsetm.tr_logcount; in xfs_symlink_log_count()
861 xfs_calc_buf_res(3, mp->m_sb.sb_sectsize) + in xfs_calc_ifree_reservation()
878 xfs_calc_buf_res(1, mp->m_sb.sb_sectsize); in xfs_calc_ichange_reservation()
892 return xfs_calc_buf_res(3, mp->m_sb.sb_sectsize) + in xfs_calc_growdata_reservation()
903 * bmap btree for bitmap/summary inode: max depth * blocksize
905 * allocation btrees for 1 block alloc: 2 * (2 * maxdepth - 1) * blocksize
911 return xfs_calc_buf_res(2, mp->m_sb.sb_sectsize) + in xfs_calc_growrtalloc_reservation()
928 return xfs_calc_buf_res(1, mp->m_sb.sb_blocksize); in xfs_calc_growrtzero_reservation()
945 return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) + in xfs_calc_growrtfree_reservation()
947 xfs_calc_buf_res(1, mp->m_sb.sb_blocksize) + in xfs_calc_growrtfree_reservation()
948 xfs_calc_buf_res(1, XFS_FSB_TO_B(mp, mp->m_rsumblocks)); in xfs_calc_growrtfree_reservation()
974 * Converting the inode from non-attributed to attributed.
987 xfs_calc_buf_res(2, mp->m_sb.sb_sectsize) + in xfs_calc_addafork_reservation()
988 xfs_calc_buf_res(1, mp->m_dir_geo->blksize) + in xfs_calc_addafork_reservation()
998 * the inode's bmap btree: max depth * block size
1004 * 4 exts * 2 trees * (2 * max depth - 1) * block size
1010 return max((xfs_calc_inode_res(mp, 1) + in xfs_calc_attrinval_reservation()
1013 (xfs_calc_buf_res(9, mp->m_sb.sb_sectsize) + in xfs_calc_attrinval_reservation()
1023 * the attribute btree * max depth
1035 xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) + in xfs_calc_attrsetm_reservation()
1042 * the inode bmap btree could join or split: max depth * block size
1047 * ext * M_RES(mp)->tr_attrsetrt.tr_logres
1053 return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) + in xfs_calc_attrsetrt_reservation()
1061 * the attribute btree could join: max depth * block size
1062 * the inode bmap btree could join or split: max depth * block size
1067 * the allocation btrees: 2 exts * 2 trees * (2 * max depth - 1) * block size
1074 max((xfs_calc_inode_res(mp, 1) + in xfs_calc_attrrm_reservation()
1080 (xfs_calc_buf_res(5, mp->m_sb.sb_sectsize) + in xfs_calc_attrrm_reservation()
1092 return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize); in xfs_calc_clear_agi_bucket_reservation()
1117 XFS_FSB_TO_B(mp, XFS_DQUOT_CLUSTER_SIZE_FSB) - 1); in xfs_calc_qm_dqalloc_reservation()
1135 return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize); in xfs_calc_sb_reservation()
1157 ASSERT(resp->tr_attrsetm.tr_logres > 0); in xfs_calc_namespace_reservations()
1159 resp->tr_rename.tr_logres = xfs_calc_rename_reservation(mp); in xfs_calc_namespace_reservations()
1160 resp->tr_rename.tr_logcount = xfs_rename_log_count(mp, resp); in xfs_calc_namespace_reservations()
1161 resp->tr_rename.tr_logflags |= XFS_TRANS_PERM_LOG_RES; in xfs_calc_namespace_reservations()
1163 resp->tr_link.tr_logres = xfs_calc_link_reservation(mp); in xfs_calc_namespace_reservations()
1164 resp->tr_link.tr_logcount = xfs_link_log_count(mp, resp); in xfs_calc_namespace_reservations()
1165 resp->tr_link.tr_logflags |= XFS_TRANS_PERM_LOG_RES; in xfs_calc_namespace_reservations()
1167 resp->tr_remove.tr_logres = xfs_calc_remove_reservation(mp); in xfs_calc_namespace_reservations()
1168 resp->tr_remove.tr_logcount = xfs_remove_log_count(mp, resp); in xfs_calc_namespace_reservations()
1169 resp->tr_remove.tr_logflags |= XFS_TRANS_PERM_LOG_RES; in xfs_calc_namespace_reservations()
1171 resp->tr_symlink.tr_logres = xfs_calc_symlink_reservation(mp); in xfs_calc_namespace_reservations()
1172 resp->tr_symlink.tr_logcount = xfs_symlink_log_count(mp, resp); in xfs_calc_namespace_reservations()
1173 resp->tr_symlink.tr_logflags |= XFS_TRANS_PERM_LOG_RES; in xfs_calc_namespace_reservations()
1175 resp->tr_create.tr_logres = xfs_calc_icreate_reservation(mp); in xfs_calc_namespace_reservations()
1176 resp->tr_create.tr_logcount = xfs_icreate_log_count(mp, resp); in xfs_calc_namespace_reservations()
1177 resp->tr_create.tr_logflags |= XFS_TRANS_PERM_LOG_RES; in xfs_calc_namespace_reservations()
1179 resp->tr_mkdir.tr_logres = xfs_calc_mkdir_reservation(mp); in xfs_calc_namespace_reservations()
1180 resp->tr_mkdir.tr_logcount = xfs_mkdir_log_count(mp, resp); in xfs_calc_namespace_reservations()
1181 resp->tr_mkdir.tr_logflags |= XFS_TRANS_PERM_LOG_RES; in xfs_calc_namespace_reservations()
1195 resp->tr_write.tr_logres = xfs_calc_write_reservation(mp, false); in xfs_trans_resv_calc()
1196 resp->tr_write.tr_logcount = XFS_WRITE_LOG_COUNT; in xfs_trans_resv_calc()
1197 resp->tr_write.tr_logflags |= XFS_TRANS_PERM_LOG_RES; in xfs_trans_resv_calc()
1199 resp->tr_itruncate.tr_logres = xfs_calc_itruncate_reservation(mp, false); in xfs_trans_resv_calc()
1200 resp->tr_itruncate.tr_logcount = XFS_ITRUNCATE_LOG_COUNT; in xfs_trans_resv_calc()
1201 resp->tr_itruncate.tr_logflags |= XFS_TRANS_PERM_LOG_RES; in xfs_trans_resv_calc()
1203 resp->tr_create_tmpfile.tr_logres = in xfs_trans_resv_calc()
1205 resp->tr_create_tmpfile.tr_logcount = XFS_CREATE_TMPFILE_LOG_COUNT; in xfs_trans_resv_calc()
1206 resp->tr_create_tmpfile.tr_logflags |= XFS_TRANS_PERM_LOG_RES; in xfs_trans_resv_calc()
1208 resp->tr_ifree.tr_logres = xfs_calc_ifree_reservation(mp); in xfs_trans_resv_calc()
1209 resp->tr_ifree.tr_logcount = XFS_INACTIVE_LOG_COUNT; in xfs_trans_resv_calc()
1210 resp->tr_ifree.tr_logflags |= XFS_TRANS_PERM_LOG_RES; in xfs_trans_resv_calc()
1212 resp->tr_addafork.tr_logres = xfs_calc_addafork_reservation(mp); in xfs_trans_resv_calc()
1213 resp->tr_addafork.tr_logcount = XFS_ADDAFORK_LOG_COUNT; in xfs_trans_resv_calc()
1214 resp->tr_addafork.tr_logflags |= XFS_TRANS_PERM_LOG_RES; in xfs_trans_resv_calc()
1216 resp->tr_attrinval.tr_logres = xfs_calc_attrinval_reservation(mp); in xfs_trans_resv_calc()
1217 resp->tr_attrinval.tr_logcount = XFS_ATTRINVAL_LOG_COUNT; in xfs_trans_resv_calc()
1218 resp->tr_attrinval.tr_logflags |= XFS_TRANS_PERM_LOG_RES; in xfs_trans_resv_calc()
1220 resp->tr_attrsetm.tr_logres = xfs_calc_attrsetm_reservation(mp); in xfs_trans_resv_calc()
1221 resp->tr_attrsetm.tr_logcount = XFS_ATTRSET_LOG_COUNT; in xfs_trans_resv_calc()
1222 resp->tr_attrsetm.tr_logflags |= XFS_TRANS_PERM_LOG_RES; in xfs_trans_resv_calc()
1224 resp->tr_attrrm.tr_logres = xfs_calc_attrrm_reservation(mp); in xfs_trans_resv_calc()
1225 resp->tr_attrrm.tr_logcount = XFS_ATTRRM_LOG_COUNT; in xfs_trans_resv_calc()
1226 resp->tr_attrrm.tr_logflags |= XFS_TRANS_PERM_LOG_RES; in xfs_trans_resv_calc()
1228 resp->tr_growrtalloc.tr_logres = xfs_calc_growrtalloc_reservation(mp); in xfs_trans_resv_calc()
1229 resp->tr_growrtalloc.tr_logcount = XFS_DEFAULT_PERM_LOG_COUNT; in xfs_trans_resv_calc()
1230 resp->tr_growrtalloc.tr_logflags |= XFS_TRANS_PERM_LOG_RES; in xfs_trans_resv_calc()
1232 resp->tr_qm_dqalloc.tr_logres = xfs_calc_qm_dqalloc_reservation(mp, in xfs_trans_resv_calc()
1234 resp->tr_qm_dqalloc.tr_logcount = XFS_WRITE_LOG_COUNT; in xfs_trans_resv_calc()
1235 resp->tr_qm_dqalloc.tr_logflags |= XFS_TRANS_PERM_LOG_RES; in xfs_trans_resv_calc()
1243 resp->tr_qm_setqlim.tr_logres = xfs_calc_qm_setqlim_reservation(); in xfs_trans_resv_calc()
1244 resp->tr_qm_setqlim.tr_logcount = XFS_DEFAULT_LOG_COUNT; in xfs_trans_resv_calc()
1246 resp->tr_sb.tr_logres = xfs_calc_sb_reservation(mp); in xfs_trans_resv_calc()
1247 resp->tr_sb.tr_logcount = XFS_DEFAULT_LOG_COUNT; in xfs_trans_resv_calc()
1250 resp->tr_growdata.tr_logres = xfs_calc_growdata_reservation(mp); in xfs_trans_resv_calc()
1251 resp->tr_growdata.tr_logcount = XFS_DEFAULT_PERM_LOG_COUNT; in xfs_trans_resv_calc()
1252 resp->tr_growdata.tr_logflags |= XFS_TRANS_PERM_LOG_RES; in xfs_trans_resv_calc()
1255 resp->tr_ichange.tr_logres = xfs_calc_ichange_reservation(mp); in xfs_trans_resv_calc()
1256 resp->tr_fsyncts.tr_logres = xfs_calc_swrite_reservation(mp); in xfs_trans_resv_calc()
1257 resp->tr_writeid.tr_logres = xfs_calc_writeid_reservation(mp); in xfs_trans_resv_calc()
1258 resp->tr_attrsetrt.tr_logres = xfs_calc_attrsetrt_reservation(mp); in xfs_trans_resv_calc()
1259 resp->tr_clearagi.tr_logres = xfs_calc_clear_agi_bucket_reservation(mp); in xfs_trans_resv_calc()
1260 resp->tr_growrtzero.tr_logres = xfs_calc_growrtzero_reservation(mp); in xfs_trans_resv_calc()
1261 resp->tr_growrtfree.tr_logres = xfs_calc_growrtfree_reservation(mp); in xfs_trans_resv_calc()
1275 resp->tr_itruncate.tr_logcount += logcount_adj; in xfs_trans_resv_calc()
1276 resp->tr_write.tr_logcount += logcount_adj; in xfs_trans_resv_calc()
1277 resp->tr_qm_dqalloc.tr_logcount += logcount_adj; in xfs_trans_resv_calc()