aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_trans.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_trans.c')
-rw-r--r--fs/xfs/xfs_trans.c193
1 files changed, 156 insertions, 37 deletions
diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
index d3d714e6b32a..8d056cef5d1f 100644
--- a/fs/xfs/xfs_trans.c
+++ b/fs/xfs/xfs_trans.c
@@ -55,10 +55,141 @@ STATIC void xfs_trans_committed(xfs_trans_t *, int);
55STATIC void xfs_trans_chunk_committed(xfs_log_item_chunk_t *, xfs_lsn_t, int); 55STATIC void xfs_trans_chunk_committed(xfs_log_item_chunk_t *, xfs_lsn_t, int);
56STATIC void xfs_trans_free(xfs_trans_t *); 56STATIC void xfs_trans_free(xfs_trans_t *);
57 57
58kmem_zone_t *xfs_trans_zone; 58kmem_zone_t *xfs_trans_zone;
59 59
60 60
61/* 61/*
62 * Reservation functions here avoid a huge stack in xfs_trans_init
63 * due to register overflow from temporaries in the calculations.
64 */
65
66STATIC uint
67xfs_calc_write_reservation(xfs_mount_t *mp)
68{
69 return XFS_CALC_WRITE_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp);
70}
71
72STATIC uint
73xfs_calc_itruncate_reservation(xfs_mount_t *mp)
74{
75 return XFS_CALC_ITRUNCATE_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp);
76}
77
78STATIC uint
79xfs_calc_rename_reservation(xfs_mount_t *mp)
80{
81 return XFS_CALC_RENAME_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp);
82}
83
84STATIC uint
85xfs_calc_link_reservation(xfs_mount_t *mp)
86{
87 return XFS_CALC_LINK_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp);
88}
89
90STATIC uint
91xfs_calc_remove_reservation(xfs_mount_t *mp)
92{
93 return XFS_CALC_REMOVE_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp);
94}
95
96STATIC uint
97xfs_calc_symlink_reservation(xfs_mount_t *mp)
98{
99 return XFS_CALC_SYMLINK_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp);
100}
101
102STATIC uint
103xfs_calc_create_reservation(xfs_mount_t *mp)
104{
105 return XFS_CALC_CREATE_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp);
106}
107
108STATIC uint
109xfs_calc_mkdir_reservation(xfs_mount_t *mp)
110{
111 return XFS_CALC_MKDIR_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp);
112}
113
114STATIC uint
115xfs_calc_ifree_reservation(xfs_mount_t *mp)
116{
117 return XFS_CALC_IFREE_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp);
118}
119
120STATIC uint
121xfs_calc_ichange_reservation(xfs_mount_t *mp)
122{
123 return XFS_CALC_ICHANGE_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp);
124}
125
126STATIC uint
127xfs_calc_growdata_reservation(xfs_mount_t *mp)
128{
129 return XFS_CALC_GROWDATA_LOG_RES(mp);
130}
131
132STATIC uint
133xfs_calc_growrtalloc_reservation(xfs_mount_t *mp)
134{
135 return XFS_CALC_GROWRTALLOC_LOG_RES(mp);
136}
137
138STATIC uint
139xfs_calc_growrtzero_reservation(xfs_mount_t *mp)
140{
141 return XFS_CALC_GROWRTZERO_LOG_RES(mp);
142}
143
144STATIC uint
145xfs_calc_growrtfree_reservation(xfs_mount_t *mp)
146{
147 return XFS_CALC_GROWRTFREE_LOG_RES(mp);
148}
149
150STATIC uint
151xfs_calc_swrite_reservation(xfs_mount_t *mp)
152{
153 return XFS_CALC_SWRITE_LOG_RES(mp);
154}
155
156STATIC uint
157xfs_calc_writeid_reservation(xfs_mount_t *mp)
158{
159 return XFS_CALC_WRITEID_LOG_RES(mp);
160}
161
162STATIC uint
163xfs_calc_addafork_reservation(xfs_mount_t *mp)
164{
165 return XFS_CALC_ADDAFORK_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp);
166}
167
168STATIC uint
169xfs_calc_attrinval_reservation(xfs_mount_t *mp)
170{
171 return XFS_CALC_ATTRINVAL_LOG_RES(mp);
172}
173
174STATIC uint
175xfs_calc_attrset_reservation(xfs_mount_t *mp)
176{
177 return XFS_CALC_ATTRSET_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp);
178}
179
180STATIC uint
181xfs_calc_attrrm_reservation(xfs_mount_t *mp)
182{
183 return XFS_CALC_ATTRRM_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp);
184}
185
186STATIC uint
187xfs_calc_clear_agi_bucket_reservation(xfs_mount_t *mp)
188{
189 return XFS_CALC_CLEAR_AGI_BUCKET_LOG_RES(mp);
190}
191
192/*
62 * Initialize the precomputed transaction reservation values 193 * Initialize the precomputed transaction reservation values
63 * in the mount structure. 194 * in the mount structure.
64 */ 195 */
@@ -69,39 +200,27 @@ xfs_trans_init(
69 xfs_trans_reservations_t *resp; 200 xfs_trans_reservations_t *resp;
70 201
71 resp = &(mp->m_reservations); 202 resp = &(mp->m_reservations);
72 resp->tr_write = 203 resp->tr_write = xfs_calc_write_reservation(mp);
73 (uint)(XFS_CALC_WRITE_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp)); 204 resp->tr_itruncate = xfs_calc_itruncate_reservation(mp);
74 resp->tr_itruncate = 205 resp->tr_rename = xfs_calc_rename_reservation(mp);
75 (uint)(XFS_CALC_ITRUNCATE_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp)); 206 resp->tr_link = xfs_calc_link_reservation(mp);
76 resp->tr_rename = 207 resp->tr_remove = xfs_calc_remove_reservation(mp);
77 (uint)(XFS_CALC_RENAME_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp)); 208 resp->tr_symlink = xfs_calc_symlink_reservation(mp);
78 resp->tr_link = (uint)XFS_CALC_LINK_LOG_RES(mp); 209 resp->tr_create = xfs_calc_create_reservation(mp);
79 resp->tr_remove = 210 resp->tr_mkdir = xfs_calc_mkdir_reservation(mp);
80 (uint)(XFS_CALC_REMOVE_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp)); 211 resp->tr_ifree = xfs_calc_ifree_reservation(mp);
81 resp->tr_symlink = 212 resp->tr_ichange = xfs_calc_ichange_reservation(mp);
82 (uint)(XFS_CALC_SYMLINK_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp)); 213 resp->tr_growdata = xfs_calc_growdata_reservation(mp);
83 resp->tr_create = 214 resp->tr_swrite = xfs_calc_swrite_reservation(mp);
84 (uint)(XFS_CALC_CREATE_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp)); 215 resp->tr_writeid = xfs_calc_writeid_reservation(mp);
85 resp->tr_mkdir = 216 resp->tr_addafork = xfs_calc_addafork_reservation(mp);
86 (uint)(XFS_CALC_MKDIR_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp)); 217 resp->tr_attrinval = xfs_calc_attrinval_reservation(mp);
87 resp->tr_ifree = 218 resp->tr_attrset = xfs_calc_attrset_reservation(mp);
88 (uint)(XFS_CALC_IFREE_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp)); 219 resp->tr_attrrm = xfs_calc_attrrm_reservation(mp);
89 resp->tr_ichange = 220 resp->tr_clearagi = xfs_calc_clear_agi_bucket_reservation(mp);
90 (uint)(XFS_CALC_ICHANGE_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp)); 221 resp->tr_growrtalloc = xfs_calc_growrtalloc_reservation(mp);
91 resp->tr_growdata = (uint)XFS_CALC_GROWDATA_LOG_RES(mp); 222 resp->tr_growrtzero = xfs_calc_growrtzero_reservation(mp);
92 resp->tr_swrite = (uint)XFS_CALC_SWRITE_LOG_RES(mp); 223 resp->tr_growrtfree = xfs_calc_growrtfree_reservation(mp);
93 resp->tr_writeid = (uint)XFS_CALC_WRITEID_LOG_RES(mp);
94 resp->tr_addafork =
95 (uint)(XFS_CALC_ADDAFORK_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp));
96 resp->tr_attrinval = (uint)XFS_CALC_ATTRINVAL_LOG_RES(mp);
97 resp->tr_attrset =
98 (uint)(XFS_CALC_ATTRSET_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp));
99 resp->tr_attrrm =
100 (uint)(XFS_CALC_ATTRRM_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp));
101 resp->tr_clearagi = (uint)XFS_CALC_CLEAR_AGI_BUCKET_LOG_RES(mp);
102 resp->tr_growrtalloc = (uint)XFS_CALC_GROWRTALLOC_LOG_RES(mp);
103 resp->tr_growrtzero = (uint)XFS_CALC_GROWRTZERO_LOG_RES(mp);
104 resp->tr_growrtfree = (uint)XFS_CALC_GROWRTFREE_LOG_RES(mp);
105} 224}
106 225
107/* 226/*
@@ -371,7 +490,7 @@ xfs_trans_mod_sb(
371 case XFS_TRANS_SB_RES_FREXTENTS: 490 case XFS_TRANS_SB_RES_FREXTENTS:
372 /* 491 /*
373 * The allocation has already been applied to the 492 * The allocation has already been applied to the
374 * in-core superblocks's counter. This should only 493 * in-core superblock's counter. This should only
375 * be applied to the on-disk superblock. 494 * be applied to the on-disk superblock.
376 */ 495 */
377 ASSERT(delta < 0); 496 ASSERT(delta < 0);
@@ -492,7 +611,7 @@ xfs_trans_apply_sb_deltas(
492 611
493 if (whole) 612 if (whole)
494 /* 613 /*
495 * Log the whole thing, the fields are discontiguous. 614 * Log the whole thing, the fields are noncontiguous.
496 */ 615 */
497 xfs_trans_log_buf(tp, bp, 0, sizeof(xfs_sb_t) - 1); 616 xfs_trans_log_buf(tp, bp, 0, sizeof(xfs_sb_t) - 1);
498 else 617 else
@@ -550,7 +669,7 @@ xfs_trans_unreserve_and_mod_sb(
550 /* 669 /*
551 * Apply any superblock modifications to the in-core version. 670 * Apply any superblock modifications to the in-core version.
552 * The t_res_fdblocks_delta and t_res_frextents_delta fields are 671 * The t_res_fdblocks_delta and t_res_frextents_delta fields are
553 * explicity NOT applied to the in-core superblock. 672 * explicitly NOT applied to the in-core superblock.
554 * The idea is that that has already been done. 673 * The idea is that that has already been done.
555 */ 674 */
556 if (tp->t_flags & XFS_TRANS_SB_DIRTY) { 675 if (tp->t_flags & XFS_TRANS_SB_DIRTY) {