diff options
Diffstat (limited to 'fs/ocfs2/journal.h')
-rw-r--r-- | fs/ocfs2/journal.h | 78 |
1 files changed, 11 insertions, 67 deletions
diff --git a/fs/ocfs2/journal.h b/fs/ocfs2/journal.h index 5be161a4ad9f..899112ad8136 100644 --- a/fs/ocfs2/journal.h +++ b/fs/ocfs2/journal.h | |||
@@ -37,7 +37,6 @@ enum ocfs2_journal_state { | |||
37 | 37 | ||
38 | struct ocfs2_super; | 38 | struct ocfs2_super; |
39 | struct ocfs2_dinode; | 39 | struct ocfs2_dinode; |
40 | struct ocfs2_journal_handle; | ||
41 | 40 | ||
42 | struct ocfs2_journal { | 41 | struct ocfs2_journal { |
43 | enum ocfs2_journal_state j_state; /* Journals current state */ | 42 | enum ocfs2_journal_state j_state; /* Journals current state */ |
@@ -133,44 +132,6 @@ static inline void ocfs2_inode_set_new(struct ocfs2_super *osb, | |||
133 | spin_unlock(&trans_inc_lock); | 132 | spin_unlock(&trans_inc_lock); |
134 | } | 133 | } |
135 | 134 | ||
136 | extern kmem_cache_t *ocfs2_lock_cache; | ||
137 | |||
138 | struct ocfs2_journal_lock { | ||
139 | struct inode *jl_inode; | ||
140 | struct list_head jl_lock_list; | ||
141 | }; | ||
142 | |||
143 | struct ocfs2_journal_handle { | ||
144 | handle_t *k_handle; /* kernel handle. */ | ||
145 | struct ocfs2_journal *journal; | ||
146 | u32 flags; /* see flags below. */ | ||
147 | int max_buffs; /* Buffs reserved by this handle */ | ||
148 | |||
149 | /* The following two fields are for ocfs2_handle_add_lock */ | ||
150 | int num_locks; | ||
151 | struct list_head locks; /* A bunch of locks to | ||
152 | * release on commit. This | ||
153 | * should be a list_head */ | ||
154 | |||
155 | struct list_head inode_list; | ||
156 | }; | ||
157 | |||
158 | #define OCFS2_HANDLE_STARTED 1 | ||
159 | /* should we sync-commit this handle? */ | ||
160 | #define OCFS2_HANDLE_SYNC 2 | ||
161 | static inline int ocfs2_handle_started(struct ocfs2_journal_handle *handle) | ||
162 | { | ||
163 | return handle->flags & OCFS2_HANDLE_STARTED; | ||
164 | } | ||
165 | |||
166 | static inline void ocfs2_handle_set_sync(struct ocfs2_journal_handle *handle, int sync) | ||
167 | { | ||
168 | if (sync) | ||
169 | handle->flags |= OCFS2_HANDLE_SYNC; | ||
170 | else | ||
171 | handle->flags &= ~OCFS2_HANDLE_SYNC; | ||
172 | } | ||
173 | |||
174 | /* Exported only for the journal struct init code in super.c. Do not call. */ | 135 | /* Exported only for the journal struct init code in super.c. Do not call. */ |
175 | void ocfs2_complete_recovery(struct work_struct *work); | 136 | void ocfs2_complete_recovery(struct work_struct *work); |
176 | 137 | ||
@@ -231,15 +192,14 @@ static inline void ocfs2_checkpoint_inode(struct inode *inode) | |||
231 | * Transaction Handling: | 192 | * Transaction Handling: |
232 | * Manage the lifetime of a transaction handle. | 193 | * Manage the lifetime of a transaction handle. |
233 | * | 194 | * |
234 | * ocfs2_alloc_handle - Only allocate a handle so we can start putting | ||
235 | * cluster locks on it. To actually change blocks, | ||
236 | * call ocfs2_start_trans with the handle returned | ||
237 | * from this function. You may call ocfs2_commit_trans | ||
238 | * at any time in the lifetime of a handle. | ||
239 | * ocfs2_start_trans - Begin a transaction. Give it an upper estimate of | 195 | * ocfs2_start_trans - Begin a transaction. Give it an upper estimate of |
240 | * the number of blocks that will be changed during | 196 | * the number of blocks that will be changed during |
241 | * this handle. | 197 | * this handle. |
242 | * ocfs2_commit_trans - Complete a handle. | 198 | * ocfs2_commit_trans - Complete a handle. It might return -EIO if |
199 | * the journal was aborted. The majority of paths don't | ||
200 | * check the return value as an error there comes too | ||
201 | * late to do anything (and will be picked up in a | ||
202 | * later transaction). | ||
243 | * ocfs2_extend_trans - Extend a handle by nblocks credits. This may | 203 | * ocfs2_extend_trans - Extend a handle by nblocks credits. This may |
244 | * commit the handle to disk in the process, but will | 204 | * commit the handle to disk in the process, but will |
245 | * not release any locks taken during the transaction. | 205 | * not release any locks taken during the transaction. |
@@ -249,24 +209,16 @@ static inline void ocfs2_checkpoint_inode(struct inode *inode) | |||
249 | * ocfs2_journal_dirty - Mark a journalled buffer as having dirty data. | 209 | * ocfs2_journal_dirty - Mark a journalled buffer as having dirty data. |
250 | * ocfs2_journal_dirty_data - Indicate that a data buffer should go out before | 210 | * ocfs2_journal_dirty_data - Indicate that a data buffer should go out before |
251 | * the current handle commits. | 211 | * the current handle commits. |
252 | * ocfs2_handle_add_lock - Sometimes we need to delay lock release | ||
253 | * until after a transaction has been completed. Use | ||
254 | * ocfs2_handle_add_lock to indicate that a lock needs | ||
255 | * to be released at the end of that handle. Locks | ||
256 | * will be released in the order that they are added. | ||
257 | * ocfs2_handle_add_inode - Add a locked inode to a transaction. | ||
258 | */ | 212 | */ |
259 | 213 | ||
260 | /* You must always start_trans with a number of buffs > 0, but it's | 214 | /* You must always start_trans with a number of buffs > 0, but it's |
261 | * perfectly legal to go through an entire transaction without having | 215 | * perfectly legal to go through an entire transaction without having |
262 | * dirtied any buffers. */ | 216 | * dirtied any buffers. */ |
263 | struct ocfs2_journal_handle *ocfs2_alloc_handle(struct ocfs2_super *osb); | 217 | handle_t *ocfs2_start_trans(struct ocfs2_super *osb, |
264 | struct ocfs2_journal_handle *ocfs2_start_trans(struct ocfs2_super *osb, | ||
265 | struct ocfs2_journal_handle *handle, | ||
266 | int max_buffs); | 218 | int max_buffs); |
267 | void ocfs2_commit_trans(struct ocfs2_journal_handle *handle); | 219 | int ocfs2_commit_trans(struct ocfs2_super *osb, |
268 | int ocfs2_extend_trans(struct ocfs2_journal_handle *handle, | 220 | handle_t *handle); |
269 | int nblocks); | 221 | int ocfs2_extend_trans(handle_t *handle, int nblocks); |
270 | 222 | ||
271 | /* | 223 | /* |
272 | * Create access is for when we get a newly created buffer and we're | 224 | * Create access is for when we get a newly created buffer and we're |
@@ -283,7 +235,7 @@ int ocfs2_extend_trans(struct ocfs2_journal_handle *handle, | |||
283 | #define OCFS2_JOURNAL_ACCESS_WRITE 1 | 235 | #define OCFS2_JOURNAL_ACCESS_WRITE 1 |
284 | #define OCFS2_JOURNAL_ACCESS_UNDO 2 | 236 | #define OCFS2_JOURNAL_ACCESS_UNDO 2 |
285 | 237 | ||
286 | int ocfs2_journal_access(struct ocfs2_journal_handle *handle, | 238 | int ocfs2_journal_access(handle_t *handle, |
287 | struct inode *inode, | 239 | struct inode *inode, |
288 | struct buffer_head *bh, | 240 | struct buffer_head *bh, |
289 | int type); | 241 | int type); |
@@ -306,18 +258,10 @@ int ocfs2_journal_access(struct ocfs2_journal_handle *handle, | |||
306 | * <modify the bh> | 258 | * <modify the bh> |
307 | * ocfs2_journal_dirty(handle, bh); | 259 | * ocfs2_journal_dirty(handle, bh); |
308 | */ | 260 | */ |
309 | int ocfs2_journal_dirty(struct ocfs2_journal_handle *handle, | 261 | int ocfs2_journal_dirty(handle_t *handle, |
310 | struct buffer_head *bh); | 262 | struct buffer_head *bh); |
311 | int ocfs2_journal_dirty_data(handle_t *handle, | 263 | int ocfs2_journal_dirty_data(handle_t *handle, |
312 | struct buffer_head *bh); | 264 | struct buffer_head *bh); |
313 | int ocfs2_handle_add_lock(struct ocfs2_journal_handle *handle, | ||
314 | struct inode *inode); | ||
315 | /* | ||
316 | * Use this to protect from other processes reading buffer state while | ||
317 | * it's in flight. | ||
318 | */ | ||
319 | void ocfs2_handle_add_inode(struct ocfs2_journal_handle *handle, | ||
320 | struct inode *inode); | ||
321 | 265 | ||
322 | /* | 266 | /* |
323 | * Credit Macros: | 267 | * Credit Macros: |