hc
2024-09-20 a36159eec6ca17402b0e146b86efaf76568dc353
kernel/fs/xfs/libxfs/xfs_trans_resv.c
....@@ -15,12 +15,10 @@
1515 #include "xfs_da_btree.h"
1616 #include "xfs_inode.h"
1717 #include "xfs_bmap_btree.h"
18
-#include "xfs_ialloc.h"
1918 #include "xfs_quota.h"
2019 #include "xfs_trans.h"
2120 #include "xfs_qm.h"
2221 #include "xfs_trans_space.h"
23
-#include "xfs_trace.h"
2422
2523 #define _ALLOC true
2624 #define _FREE false
....@@ -136,9 +134,10 @@
136134 xfs_calc_inobt_res(
137135 struct xfs_mount *mp)
138136 {
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));
142141 }
143142
144143 /*
....@@ -167,7 +166,7 @@
167166 * includes:
168167 *
169168 * 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
171170 *
172171 * The size N of the inode chunk reservation depends on whether it is for
173172 * allocation or free and which type of create transaction is in use. An inode
....@@ -188,12 +187,12 @@
188187 XFS_FSB_TO_B(mp, 1));
189188 if (alloc) {
190189 /* icreate tx uses ordered buffers */
191
- if (xfs_sb_version_hascrc(&mp->m_sb))
190
+ if (xfs_sb_version_has_v3inode(&mp->m_sb))
192191 return res;
193192 size = XFS_FSB_TO_B(mp, 1);
194193 }
195194
196
- res += xfs_calc_buf_res(mp->m_ialloc_blks, size);
195
+ res += xfs_calc_buf_res(M_IGEO(mp)->ialloc_blks, size);
197196 return res;
198197 }
199198
....@@ -203,7 +202,7 @@
203202 * blocks as needed to mark inuse MAXEXTLEN blocks' worth of realtime extents,
204203 * as well as the realtime summary block.
205204 */
206
-unsigned int
205
+static unsigned int
207206 xfs_rtalloc_log_count(
208207 struct xfs_mount *mp,
209208 unsigned int num_ops)
....@@ -365,7 +364,7 @@
365364 struct xfs_mount *mp)
366365 {
367366 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;
369368 }
370369
371370 /*
....@@ -403,7 +402,7 @@
403402 xfs_calc_iunlink_add_reservation(xfs_mount_t *mp)
404403 {
405404 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;
407406 }
408407
409408 /*
....@@ -777,7 +776,7 @@
777776
778777 /*
779778 * Adjusting quota limits.
780
- * the xfs_disk_dquot_t: sizeof(struct xfs_disk_dquot)
779
+ * the disk quota buffer: sizeof(struct xfs_disk_dquot)
781780 */
782781 STATIC uint
783782 xfs_calc_qm_setqlim_reservation(void)
....@@ -801,7 +800,7 @@
801800
802801 /*
803802 * 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
805804 * the superblock for the quota flags: sector size
806805 */
807806 STATIC uint
....@@ -814,7 +813,7 @@
814813
815814 /*
816815 * 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
818817 */
819818 STATIC uint
820819 xfs_calc_qm_quotaoff_end_reservation(void)
....@@ -934,9 +933,13 @@
934933 resp->tr_sb.tr_logres = xfs_calc_sb_reservation(mp);
935934 resp->tr_sb.tr_logcount = XFS_DEFAULT_LOG_COUNT;
936935
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
+
937941 /* The following transaction are logged in logical format */
938942 resp->tr_ichange.tr_logres = xfs_calc_ichange_reservation(mp);
939
- resp->tr_growdata.tr_logres = xfs_calc_growdata_reservation(mp);
940943 resp->tr_fsyncts.tr_logres = xfs_calc_swrite_reservation(mp);
941944 resp->tr_writeid.tr_logres = xfs_calc_writeid_reservation(mp);
942945 resp->tr_attrsetrt.tr_logres = xfs_calc_attrsetrt_reservation(mp);