aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/journal.c
diff options
context:
space:
mode:
authorMark Fasheh <mark.fasheh@oracle.com>2006-10-06 22:05:31 -0400
committerMark Fasheh <mark.fasheh@oracle.com>2006-12-01 21:27:58 -0500
commitdaf29e9cdab7219838c6b6e82380aec3466cf379 (patch)
treeb8ee26fadd65ca2c037ee34d6a061960eaec2174 /fs/ocfs2/journal.c
parent02928a71ae6da6e3e205d99e1fa1a1f598ddb62d (diff)
ocfs2: remove unused ocfs2_handle_add_lock()
This gets us rid of a slab we no longer need, as well as removing the majority of what's left on ocfs2_journal_handle. ocfs2_commit_unstarted_handle() has no more real work to do, so remove that function too. Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs/ocfs2/journal.c')
-rw-r--r--fs/ocfs2/journal.c80
1 files changed, 2 insertions, 78 deletions
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
index f02af63e5fae..3ef1678c893a 100644
--- a/fs/ocfs2/journal.c
+++ b/fs/ocfs2/journal.c
@@ -57,9 +57,6 @@ static int ocfs2_recover_node(struct ocfs2_super *osb,
57static int __ocfs2_recovery_thread(void *arg); 57static int __ocfs2_recovery_thread(void *arg);
58static int ocfs2_commit_cache(struct ocfs2_super *osb); 58static int ocfs2_commit_cache(struct ocfs2_super *osb);
59static int ocfs2_wait_on_mount(struct ocfs2_super *osb); 59static int ocfs2_wait_on_mount(struct ocfs2_super *osb);
60static void ocfs2_handle_cleanup_locks(struct ocfs2_journal *journal,
61 struct ocfs2_journal_handle *handle);
62static void ocfs2_commit_unstarted_handle(struct ocfs2_journal_handle *handle);
63static int ocfs2_journal_toggle_dirty(struct ocfs2_super *osb, 60static int ocfs2_journal_toggle_dirty(struct ocfs2_super *osb,
64 int dirty); 61 int dirty);
65static int ocfs2_trylock_journal(struct ocfs2_super *osb, 62static int ocfs2_trylock_journal(struct ocfs2_super *osb,
@@ -123,11 +120,8 @@ struct ocfs2_journal_handle *ocfs2_alloc_handle(struct ocfs2_super *osb)
123 "handle!\n"); 120 "handle!\n");
124 return NULL; 121 return NULL;
125 } 122 }
126
127 retval->num_locks = 0;
128 retval->k_handle = NULL; 123 retval->k_handle = NULL;
129 124
130 INIT_LIST_HEAD(&retval->locks);
131 retval->journal = osb->journal; 125 retval->journal = osb->journal;
132 126
133 return retval; 127 return retval;
@@ -195,27 +189,12 @@ struct ocfs2_journal_handle *ocfs2_start_trans(struct ocfs2_super *osb,
195 189
196done_free: 190done_free:
197 if (handle) 191 if (handle)
198 ocfs2_commit_unstarted_handle(handle); /* will kfree handle */ 192 kfree(handle);
199 193
200 mlog_exit(ret); 194 mlog_exit(ret);
201 return ERR_PTR(ret); 195 return ERR_PTR(ret);
202} 196}
203 197
204/* This is trivial so we do it out of the main commit
205 * paths. Beware, it can be called from start_trans too! */
206static void ocfs2_commit_unstarted_handle(struct ocfs2_journal_handle *handle)
207{
208 mlog_entry_void();
209
210 /* You are allowed to add journal locks before the transaction
211 * has started. */
212 ocfs2_handle_cleanup_locks(handle->journal, handle);
213
214 kfree(handle);
215
216 mlog_exit_void();
217}
218
219void ocfs2_commit_trans(struct ocfs2_journal_handle *handle) 198void ocfs2_commit_trans(struct ocfs2_journal_handle *handle)
220{ 199{
221 handle_t *jbd_handle; 200 handle_t *jbd_handle;
@@ -227,7 +206,7 @@ void ocfs2_commit_trans(struct ocfs2_journal_handle *handle)
227 BUG_ON(!handle); 206 BUG_ON(!handle);
228 207
229 if (!handle->k_handle) { 208 if (!handle->k_handle) {
230 ocfs2_commit_unstarted_handle(handle); 209 kfree(handle);
231 mlog_exit_void(); 210 mlog_exit_void();
232 return; 211 return;
233 } 212 }
@@ -251,8 +230,6 @@ void ocfs2_commit_trans(struct ocfs2_journal_handle *handle)
251 handle->k_handle = NULL; /* it's been free'd in journal_stop */ 230 handle->k_handle = NULL; /* it's been free'd in journal_stop */
252 } 231 }
253 232
254 ocfs2_handle_cleanup_locks(journal, handle);
255
256 up_read(&journal->j_trans_barrier); 233 up_read(&journal->j_trans_barrier);
257 234
258 kfree(handle); 235 kfree(handle);
@@ -394,59 +371,6 @@ int ocfs2_journal_dirty_data(handle_t *handle,
394 return err; 371 return err;
395} 372}
396 373
397/* We always assume you're adding a metadata lock at level 'ex' */
398int ocfs2_handle_add_lock(struct ocfs2_journal_handle *handle,
399 struct inode *inode)
400{
401 int status;
402 struct ocfs2_journal_lock *lock;
403
404 BUG_ON(!inode);
405
406 lock = kmem_cache_alloc(ocfs2_lock_cache, GFP_NOFS);
407 if (!lock) {
408 status = -ENOMEM;
409 mlog_errno(-ENOMEM);
410 goto bail;
411 }
412
413 if (!igrab(inode))
414 BUG();
415 lock->jl_inode = inode;
416
417 list_add_tail(&(lock->jl_lock_list), &(handle->locks));
418 handle->num_locks++;
419
420 status = 0;
421bail:
422 mlog_exit(status);
423 return status;
424}
425
426static void ocfs2_handle_cleanup_locks(struct ocfs2_journal *journal,
427 struct ocfs2_journal_handle *handle)
428{
429 struct list_head *p, *n;
430 struct ocfs2_journal_lock *lock;
431 struct inode *inode;
432
433 list_for_each_safe(p, n, &(handle->locks)) {
434 lock = list_entry(p, struct ocfs2_journal_lock,
435 jl_lock_list);
436 list_del(&lock->jl_lock_list);
437 handle->num_locks--;
438
439 inode = lock->jl_inode;
440 ocfs2_meta_unlock(inode, 1);
441 if (atomic_read(&inode->i_count) == 1)
442 mlog(ML_ERROR,
443 "Inode %llu, I'm doing a last iput for!",
444 (unsigned long long)OCFS2_I(inode)->ip_blkno);
445 iput(inode);
446 kmem_cache_free(ocfs2_lock_cache, lock);
447 }
448}
449
450#define OCFS2_DEFAULT_COMMIT_INTERVAL (HZ * 5) 374#define OCFS2_DEFAULT_COMMIT_INTERVAL (HZ * 5)
451 375
452void ocfs2_set_journal_params(struct ocfs2_super *osb) 376void ocfs2_set_journal_params(struct ocfs2_super *osb)