diff options
Diffstat (limited to 'fs/ocfs2/journal.h')
-rw-r--r-- | fs/ocfs2/journal.h | 85 |
1 files changed, 16 insertions, 69 deletions
diff --git a/fs/ocfs2/journal.h b/fs/ocfs2/journal.h index 2f3a6acdac45..e1216364d191 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,46 +132,8 @@ 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(void *data); | 136 | void ocfs2_complete_recovery(struct work_struct *work); |
176 | 137 | ||
177 | /* | 138 | /* |
178 | * Journal Control: | 139 | * Journal Control: |
@@ -196,7 +157,7 @@ int ocfs2_journal_init(struct ocfs2_journal *journal, | |||
196 | void ocfs2_journal_shutdown(struct ocfs2_super *osb); | 157 | void ocfs2_journal_shutdown(struct ocfs2_super *osb); |
197 | int ocfs2_journal_wipe(struct ocfs2_journal *journal, | 158 | int ocfs2_journal_wipe(struct ocfs2_journal *journal, |
198 | int full); | 159 | int full); |
199 | int ocfs2_journal_load(struct ocfs2_journal *journal); | 160 | int ocfs2_journal_load(struct ocfs2_journal *journal, int local); |
200 | int ocfs2_check_journals_nolocks(struct ocfs2_super *osb); | 161 | int ocfs2_check_journals_nolocks(struct ocfs2_super *osb); |
201 | void ocfs2_recovery_thread(struct ocfs2_super *osb, | 162 | void ocfs2_recovery_thread(struct ocfs2_super *osb, |
202 | int node_num); | 163 | int node_num); |
@@ -213,6 +174,9 @@ static inline void ocfs2_checkpoint_inode(struct inode *inode) | |||
213 | { | 174 | { |
214 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 175 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
215 | 176 | ||
177 | if (ocfs2_mount_local(osb)) | ||
178 | return; | ||
179 | |||
216 | if (!ocfs2_inode_fully_checkpointed(inode)) { | 180 | if (!ocfs2_inode_fully_checkpointed(inode)) { |
217 | /* WARNING: This only kicks off a single | 181 | /* WARNING: This only kicks off a single |
218 | * checkpoint. If someone races you and adds more | 182 | * checkpoint. If someone races you and adds more |
@@ -231,15 +195,14 @@ static inline void ocfs2_checkpoint_inode(struct inode *inode) | |||
231 | * Transaction Handling: | 195 | * Transaction Handling: |
232 | * Manage the lifetime of a transaction handle. | 196 | * Manage the lifetime of a transaction handle. |
233 | * | 197 | * |
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 | 198 | * ocfs2_start_trans - Begin a transaction. Give it an upper estimate of |
240 | * the number of blocks that will be changed during | 199 | * the number of blocks that will be changed during |
241 | * this handle. | 200 | * this handle. |
242 | * ocfs2_commit_trans - Complete a handle. | 201 | * ocfs2_commit_trans - Complete a handle. It might return -EIO if |
202 | * the journal was aborted. The majority of paths don't | ||
203 | * check the return value as an error there comes too | ||
204 | * late to do anything (and will be picked up in a | ||
205 | * later transaction). | ||
243 | * ocfs2_extend_trans - Extend a handle by nblocks credits. This may | 206 | * ocfs2_extend_trans - Extend a handle by nblocks credits. This may |
244 | * commit the handle to disk in the process, but will | 207 | * commit the handle to disk in the process, but will |
245 | * not release any locks taken during the transaction. | 208 | * not release any locks taken during the transaction. |
@@ -249,24 +212,16 @@ static inline void ocfs2_checkpoint_inode(struct inode *inode) | |||
249 | * ocfs2_journal_dirty - Mark a journalled buffer as having dirty data. | 212 | * 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 | 213 | * ocfs2_journal_dirty_data - Indicate that a data buffer should go out before |
251 | * the current handle commits. | 214 | * 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 | */ | 215 | */ |
259 | 216 | ||
260 | /* You must always start_trans with a number of buffs > 0, but it's | 217 | /* 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 | 218 | * perfectly legal to go through an entire transaction without having |
262 | * dirtied any buffers. */ | 219 | * dirtied any buffers. */ |
263 | struct ocfs2_journal_handle *ocfs2_alloc_handle(struct ocfs2_super *osb); | 220 | 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); | 221 | int max_buffs); |
267 | void ocfs2_commit_trans(struct ocfs2_journal_handle *handle); | 222 | int ocfs2_commit_trans(struct ocfs2_super *osb, |
268 | int ocfs2_extend_trans(struct ocfs2_journal_handle *handle, | 223 | handle_t *handle); |
269 | int nblocks); | 224 | int ocfs2_extend_trans(handle_t *handle, int nblocks); |
270 | 225 | ||
271 | /* | 226 | /* |
272 | * Create access is for when we get a newly created buffer and we're | 227 | * Create access is for when we get a newly created buffer and we're |
@@ -283,7 +238,7 @@ int ocfs2_extend_trans(struct ocfs2_journal_handle *handle, | |||
283 | #define OCFS2_JOURNAL_ACCESS_WRITE 1 | 238 | #define OCFS2_JOURNAL_ACCESS_WRITE 1 |
284 | #define OCFS2_JOURNAL_ACCESS_UNDO 2 | 239 | #define OCFS2_JOURNAL_ACCESS_UNDO 2 |
285 | 240 | ||
286 | int ocfs2_journal_access(struct ocfs2_journal_handle *handle, | 241 | int ocfs2_journal_access(handle_t *handle, |
287 | struct inode *inode, | 242 | struct inode *inode, |
288 | struct buffer_head *bh, | 243 | struct buffer_head *bh, |
289 | int type); | 244 | int type); |
@@ -306,18 +261,10 @@ int ocfs2_journal_access(struct ocfs2_journal_handle *handle, | |||
306 | * <modify the bh> | 261 | * <modify the bh> |
307 | * ocfs2_journal_dirty(handle, bh); | 262 | * ocfs2_journal_dirty(handle, bh); |
308 | */ | 263 | */ |
309 | int ocfs2_journal_dirty(struct ocfs2_journal_handle *handle, | 264 | int ocfs2_journal_dirty(handle_t *handle, |
310 | struct buffer_head *bh); | 265 | struct buffer_head *bh); |
311 | int ocfs2_journal_dirty_data(handle_t *handle, | 266 | int ocfs2_journal_dirty_data(handle_t *handle, |
312 | struct buffer_head *bh); | 267 | 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 | 268 | ||
322 | /* | 269 | /* |
323 | * Credit Macros: | 270 | * Credit Macros: |