diff options
Diffstat (limited to 'fs/xfs/xfs_trans.c')
| -rw-r--r-- | fs/xfs/xfs_trans.c | 187 |
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); | |||
| 55 | STATIC void xfs_trans_chunk_committed(xfs_log_item_chunk_t *, xfs_lsn_t, int); | 55 | STATIC void xfs_trans_chunk_committed(xfs_log_item_chunk_t *, xfs_lsn_t, int); |
| 56 | STATIC void xfs_trans_free(xfs_trans_t *); | 56 | STATIC void xfs_trans_free(xfs_trans_t *); |
| 57 | 57 | ||
| 58 | kmem_zone_t *xfs_trans_zone; | 58 | kmem_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 | |||
| 66 | STATIC uint | ||
| 67 | xfs_calc_write_reservation(xfs_mount_t *mp) | ||
| 68 | { | ||
| 69 | return XFS_CALC_WRITE_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp); | ||
| 70 | } | ||
| 71 | |||
| 72 | STATIC uint | ||
| 73 | xfs_calc_itruncate_reservation(xfs_mount_t *mp) | ||
| 74 | { | ||
| 75 | return XFS_CALC_ITRUNCATE_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp); | ||
| 76 | } | ||
| 77 | |||
| 78 | STATIC uint | ||
| 79 | xfs_calc_rename_reservation(xfs_mount_t *mp) | ||
| 80 | { | ||
| 81 | return XFS_CALC_RENAME_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp); | ||
| 82 | } | ||
| 83 | |||
| 84 | STATIC uint | ||
| 85 | xfs_calc_link_reservation(xfs_mount_t *mp) | ||
| 86 | { | ||
| 87 | return XFS_CALC_LINK_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp); | ||
| 88 | } | ||
| 89 | |||
| 90 | STATIC uint | ||
| 91 | xfs_calc_remove_reservation(xfs_mount_t *mp) | ||
| 92 | { | ||
| 93 | return XFS_CALC_REMOVE_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp); | ||
| 94 | } | ||
| 95 | |||
| 96 | STATIC uint | ||
| 97 | xfs_calc_symlink_reservation(xfs_mount_t *mp) | ||
| 98 | { | ||
| 99 | return XFS_CALC_SYMLINK_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp); | ||
| 100 | } | ||
| 101 | |||
| 102 | STATIC uint | ||
| 103 | xfs_calc_create_reservation(xfs_mount_t *mp) | ||
| 104 | { | ||
| 105 | return XFS_CALC_CREATE_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp); | ||
| 106 | } | ||
| 107 | |||
| 108 | STATIC uint | ||
| 109 | xfs_calc_mkdir_reservation(xfs_mount_t *mp) | ||
| 110 | { | ||
| 111 | return XFS_CALC_MKDIR_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp); | ||
| 112 | } | ||
| 113 | |||
| 114 | STATIC uint | ||
| 115 | xfs_calc_ifree_reservation(xfs_mount_t *mp) | ||
| 116 | { | ||
| 117 | return XFS_CALC_IFREE_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp); | ||
| 118 | } | ||
| 119 | |||
| 120 | STATIC uint | ||
| 121 | xfs_calc_ichange_reservation(xfs_mount_t *mp) | ||
| 122 | { | ||
| 123 | return XFS_CALC_ICHANGE_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp); | ||
| 124 | } | ||
| 125 | |||
| 126 | STATIC uint | ||
| 127 | xfs_calc_growdata_reservation(xfs_mount_t *mp) | ||
| 128 | { | ||
| 129 | return XFS_CALC_GROWDATA_LOG_RES(mp); | ||
| 130 | } | ||
| 131 | |||
| 132 | STATIC uint | ||
| 133 | xfs_calc_growrtalloc_reservation(xfs_mount_t *mp) | ||
| 134 | { | ||
| 135 | return XFS_CALC_GROWRTALLOC_LOG_RES(mp); | ||
| 136 | } | ||
| 137 | |||
| 138 | STATIC uint | ||
| 139 | xfs_calc_growrtzero_reservation(xfs_mount_t *mp) | ||
| 140 | { | ||
| 141 | return XFS_CALC_GROWRTZERO_LOG_RES(mp); | ||
| 142 | } | ||
| 143 | |||
| 144 | STATIC uint | ||
| 145 | xfs_calc_growrtfree_reservation(xfs_mount_t *mp) | ||
| 146 | { | ||
| 147 | return XFS_CALC_GROWRTFREE_LOG_RES(mp); | ||
| 148 | } | ||
| 149 | |||
| 150 | STATIC uint | ||
| 151 | xfs_calc_swrite_reservation(xfs_mount_t *mp) | ||
| 152 | { | ||
| 153 | return XFS_CALC_SWRITE_LOG_RES(mp); | ||
| 154 | } | ||
| 155 | |||
| 156 | STATIC uint | ||
| 157 | xfs_calc_writeid_reservation(xfs_mount_t *mp) | ||
| 158 | { | ||
| 159 | return XFS_CALC_WRITEID_LOG_RES(mp); | ||
| 160 | } | ||
| 161 | |||
| 162 | STATIC uint | ||
| 163 | xfs_calc_addafork_reservation(xfs_mount_t *mp) | ||
| 164 | { | ||
| 165 | return XFS_CALC_ADDAFORK_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp); | ||
| 166 | } | ||
| 167 | |||
| 168 | STATIC uint | ||
| 169 | xfs_calc_attrinval_reservation(xfs_mount_t *mp) | ||
| 170 | { | ||
| 171 | return XFS_CALC_ATTRINVAL_LOG_RES(mp); | ||
| 172 | } | ||
| 173 | |||
| 174 | STATIC uint | ||
| 175 | xfs_calc_attrset_reservation(xfs_mount_t *mp) | ||
| 176 | { | ||
| 177 | return XFS_CALC_ATTRSET_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp); | ||
| 178 | } | ||
| 179 | |||
| 180 | STATIC uint | ||
| 181 | xfs_calc_attrrm_reservation(xfs_mount_t *mp) | ||
| 182 | { | ||
| 183 | return XFS_CALC_ATTRRM_LOG_RES(mp) + XFS_DQUOT_LOGRES(mp); | ||
| 184 | } | ||
| 185 | |||
| 186 | STATIC uint | ||
| 187 | xfs_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 | /* |
