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.c187
1 files changed, 153 insertions, 34 deletions
diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
index d3d714e6b32a..2918956553a5 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/*