| .. | .. |
|---|
| 15 | 15 | #include "xfs_da_btree.h" |
|---|
| 16 | 16 | #include "xfs_inode.h" |
|---|
| 17 | 17 | #include "xfs_bmap_btree.h" |
|---|
| 18 | | -#include "xfs_ialloc.h" |
|---|
| 19 | 18 | #include "xfs_quota.h" |
|---|
| 20 | 19 | #include "xfs_trans.h" |
|---|
| 21 | 20 | #include "xfs_qm.h" |
|---|
| 22 | 21 | #include "xfs_trans_space.h" |
|---|
| 23 | | -#include "xfs_trace.h" |
|---|
| 24 | 22 | |
|---|
| 25 | 23 | #define _ALLOC true |
|---|
| 26 | 24 | #define _FREE false |
|---|
| .. | .. |
|---|
| 136 | 134 | xfs_calc_inobt_res( |
|---|
| 137 | 135 | struct xfs_mount *mp) |
|---|
| 138 | 136 | { |
|---|
| 139 | | - return xfs_calc_buf_res(mp->m_in_maxlevels, XFS_FSB_TO_B(mp, 1)) + |
|---|
| 140 | | - xfs_calc_buf_res(xfs_allocfree_log_count(mp, 1), |
|---|
| 141 | | - XFS_FSB_TO_B(mp, 1)); |
|---|
| 137 | + return xfs_calc_buf_res(M_IGEO(mp)->inobt_maxlevels, |
|---|
| 138 | + XFS_FSB_TO_B(mp, 1)) + |
|---|
| 139 | + xfs_calc_buf_res(xfs_allocfree_log_count(mp, 1), |
|---|
| 140 | + XFS_FSB_TO_B(mp, 1)); |
|---|
| 142 | 141 | } |
|---|
| 143 | 142 | |
|---|
| 144 | 143 | /* |
|---|
| .. | .. |
|---|
| 167 | 166 | * includes: |
|---|
| 168 | 167 | * |
|---|
| 169 | 168 | * the allocation btrees: 2 trees * (max depth - 1) * block size |
|---|
| 170 | | - * the inode chunk: m_ialloc_blks * N |
|---|
| 169 | + * the inode chunk: m_ino_geo.ialloc_blks * N |
|---|
| 171 | 170 | * |
|---|
| 172 | 171 | * The size N of the inode chunk reservation depends on whether it is for |
|---|
| 173 | 172 | * allocation or free and which type of create transaction is in use. An inode |
|---|
| .. | .. |
|---|
| 188 | 187 | XFS_FSB_TO_B(mp, 1)); |
|---|
| 189 | 188 | if (alloc) { |
|---|
| 190 | 189 | /* icreate tx uses ordered buffers */ |
|---|
| 191 | | - if (xfs_sb_version_hascrc(&mp->m_sb)) |
|---|
| 190 | + if (xfs_sb_version_has_v3inode(&mp->m_sb)) |
|---|
| 192 | 191 | return res; |
|---|
| 193 | 192 | size = XFS_FSB_TO_B(mp, 1); |
|---|
| 194 | 193 | } |
|---|
| 195 | 194 | |
|---|
| 196 | | - res += xfs_calc_buf_res(mp->m_ialloc_blks, size); |
|---|
| 195 | + res += xfs_calc_buf_res(M_IGEO(mp)->ialloc_blks, size); |
|---|
| 197 | 196 | return res; |
|---|
| 198 | 197 | } |
|---|
| 199 | 198 | |
|---|
| .. | .. |
|---|
| 203 | 202 | * blocks as needed to mark inuse MAXEXTLEN blocks' worth of realtime extents, |
|---|
| 204 | 203 | * as well as the realtime summary block. |
|---|
| 205 | 204 | */ |
|---|
| 206 | | -unsigned int |
|---|
| 205 | +static unsigned int |
|---|
| 207 | 206 | xfs_rtalloc_log_count( |
|---|
| 208 | 207 | struct xfs_mount *mp, |
|---|
| 209 | 208 | unsigned int num_ops) |
|---|
| .. | .. |
|---|
| 365 | 364 | struct xfs_mount *mp) |
|---|
| 366 | 365 | { |
|---|
| 367 | 366 | return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) + |
|---|
| 368 | | - 2 * max_t(uint, XFS_FSB_TO_B(mp, 1), mp->m_inode_cluster_size); |
|---|
| 367 | + 2 * M_IGEO(mp)->inode_cluster_size; |
|---|
| 369 | 368 | } |
|---|
| 370 | 369 | |
|---|
| 371 | 370 | /* |
|---|
| .. | .. |
|---|
| 403 | 402 | xfs_calc_iunlink_add_reservation(xfs_mount_t *mp) |
|---|
| 404 | 403 | { |
|---|
| 405 | 404 | return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) + |
|---|
| 406 | | - max_t(uint, XFS_FSB_TO_B(mp, 1), mp->m_inode_cluster_size); |
|---|
| 405 | + M_IGEO(mp)->inode_cluster_size; |
|---|
| 407 | 406 | } |
|---|
| 408 | 407 | |
|---|
| 409 | 408 | /* |
|---|
| .. | .. |
|---|
| 777 | 776 | |
|---|
| 778 | 777 | /* |
|---|
| 779 | 778 | * Adjusting quota limits. |
|---|
| 780 | | - * the xfs_disk_dquot_t: sizeof(struct xfs_disk_dquot) |
|---|
| 779 | + * the disk quota buffer: sizeof(struct xfs_disk_dquot) |
|---|
| 781 | 780 | */ |
|---|
| 782 | 781 | STATIC uint |
|---|
| 783 | 782 | xfs_calc_qm_setqlim_reservation(void) |
|---|
| .. | .. |
|---|
| 801 | 800 | |
|---|
| 802 | 801 | /* |
|---|
| 803 | 802 | * Turning off quotas. |
|---|
| 804 | | - * the xfs_qoff_logitem_t: sizeof(struct xfs_qoff_logitem) * 2 |
|---|
| 803 | + * the quota off logitems: sizeof(struct xfs_qoff_logitem) * 2 |
|---|
| 805 | 804 | * the superblock for the quota flags: sector size |
|---|
| 806 | 805 | */ |
|---|
| 807 | 806 | STATIC uint |
|---|
| .. | .. |
|---|
| 814 | 813 | |
|---|
| 815 | 814 | /* |
|---|
| 816 | 815 | * End of turning off quotas. |
|---|
| 817 | | - * the xfs_qoff_logitem_t: sizeof(struct xfs_qoff_logitem) * 2 |
|---|
| 816 | + * the quota off logitems: sizeof(struct xfs_qoff_logitem) * 2 |
|---|
| 818 | 817 | */ |
|---|
| 819 | 818 | STATIC uint |
|---|
| 820 | 819 | xfs_calc_qm_quotaoff_end_reservation(void) |
|---|
| .. | .. |
|---|
| 934 | 933 | resp->tr_sb.tr_logres = xfs_calc_sb_reservation(mp); |
|---|
| 935 | 934 | resp->tr_sb.tr_logcount = XFS_DEFAULT_LOG_COUNT; |
|---|
| 936 | 935 | |
|---|
| 936 | + /* growdata requires permanent res; it can free space to the last AG */ |
|---|
| 937 | + resp->tr_growdata.tr_logres = xfs_calc_growdata_reservation(mp); |
|---|
| 938 | + resp->tr_growdata.tr_logcount = XFS_DEFAULT_PERM_LOG_COUNT; |
|---|
| 939 | + resp->tr_growdata.tr_logflags |= XFS_TRANS_PERM_LOG_RES; |
|---|
| 940 | + |
|---|
| 937 | 941 | /* The following transaction are logged in logical format */ |
|---|
| 938 | 942 | resp->tr_ichange.tr_logres = xfs_calc_ichange_reservation(mp); |
|---|
| 939 | | - resp->tr_growdata.tr_logres = xfs_calc_growdata_reservation(mp); |
|---|
| 940 | 943 | resp->tr_fsyncts.tr_logres = xfs_calc_swrite_reservation(mp); |
|---|
| 941 | 944 | resp->tr_writeid.tr_logres = xfs_calc_writeid_reservation(mp); |
|---|
| 942 | 945 | resp->tr_attrsetrt.tr_logres = xfs_calc_attrsetrt_reservation(mp); |
|---|