]> err.no Git - linux-2.6/blobdiff - fs/ocfs2/journal.c
ocfs2: remove ocfs2_journal_handle journal field
[linux-2.6] / fs / ocfs2 / journal.c
index f02af63e5faef60ca7972c8f3b7717b03346cf51..81fb917475fd70ba00b8c63d8592fea18cc8a864 100644 (file)
@@ -57,9 +57,6 @@ static int ocfs2_recover_node(struct ocfs2_super *osb,
 static int __ocfs2_recovery_thread(void *arg);
 static int ocfs2_commit_cache(struct ocfs2_super *osb);
 static int ocfs2_wait_on_mount(struct ocfs2_super *osb);
-static void ocfs2_handle_cleanup_locks(struct ocfs2_journal *journal,
-                                      struct ocfs2_journal_handle *handle);
-static void ocfs2_commit_unstarted_handle(struct ocfs2_journal_handle *handle);
 static int ocfs2_journal_toggle_dirty(struct ocfs2_super *osb,
                                      int dirty);
 static int ocfs2_trylock_journal(struct ocfs2_super *osb,
@@ -113,7 +110,7 @@ finally:
        return status;
 }
 
-struct ocfs2_journal_handle *ocfs2_alloc_handle(struct ocfs2_super *osb)
+static struct ocfs2_journal_handle *ocfs2_alloc_handle(struct ocfs2_super *osb)
 {
        struct ocfs2_journal_handle *retval = NULL;
 
@@ -123,13 +120,8 @@ struct ocfs2_journal_handle *ocfs2_alloc_handle(struct ocfs2_super *osb)
                     "handle!\n");
                return NULL;
        }
-
-       retval->num_locks = 0;
        retval->k_handle = NULL;
 
-       INIT_LIST_HEAD(&retval->locks);
-       retval->journal = osb->journal;
-
        return retval;
 }
 
@@ -195,39 +187,25 @@ struct ocfs2_journal_handle *ocfs2_start_trans(struct ocfs2_super *osb,
 
 done_free:
        if (handle)
-               ocfs2_commit_unstarted_handle(handle); /* will kfree handle */
+               kfree(handle);
 
        mlog_exit(ret);
        return ERR_PTR(ret);
 }
 
-/* This is trivial so we do it out of the main commit
- * paths. Beware, it can be called from start_trans too! */
-static void ocfs2_commit_unstarted_handle(struct ocfs2_journal_handle *handle)
-{
-       mlog_entry_void();
-
-       /* You are allowed to add journal locks before the transaction
-        * has started. */
-       ocfs2_handle_cleanup_locks(handle->journal, handle);
-
-       kfree(handle);
-
-       mlog_exit_void();
-}
-
-void ocfs2_commit_trans(struct ocfs2_journal_handle *handle)
+void ocfs2_commit_trans(struct ocfs2_super *osb,
+                       struct ocfs2_journal_handle *handle)
 {
        handle_t *jbd_handle;
        int retval;
-       struct ocfs2_journal *journal = handle->journal;
+       struct ocfs2_journal *journal = osb->journal;
 
        mlog_entry_void();
 
        BUG_ON(!handle);
 
        if (!handle->k_handle) {
-               ocfs2_commit_unstarted_handle(handle);
+               kfree(handle);
                mlog_exit_void();
                return;
        }
@@ -251,8 +229,6 @@ void ocfs2_commit_trans(struct ocfs2_journal_handle *handle)
                handle->k_handle = NULL; /* it's been free'd in journal_stop */
        }
 
-       ocfs2_handle_cleanup_locks(journal, handle);
-
        up_read(&journal->j_trans_barrier);
 
        kfree(handle);
@@ -394,59 +370,6 @@ int ocfs2_journal_dirty_data(handle_t *handle,
        return err;
 }
 
-/* We always assume you're adding a metadata lock at level 'ex' */
-int ocfs2_handle_add_lock(struct ocfs2_journal_handle *handle,
-                         struct inode *inode)
-{
-       int status;
-       struct ocfs2_journal_lock *lock;
-
-       BUG_ON(!inode);
-
-       lock = kmem_cache_alloc(ocfs2_lock_cache, GFP_NOFS);
-       if (!lock) {
-               status = -ENOMEM;
-               mlog_errno(-ENOMEM);
-               goto bail;
-       }
-
-       if (!igrab(inode))
-               BUG();
-       lock->jl_inode = inode;
-
-       list_add_tail(&(lock->jl_lock_list), &(handle->locks));
-       handle->num_locks++;
-
-       status = 0;
-bail:
-       mlog_exit(status);
-       return status;
-}
-
-static void ocfs2_handle_cleanup_locks(struct ocfs2_journal *journal,
-                                      struct ocfs2_journal_handle *handle)
-{
-       struct list_head *p, *n;
-       struct ocfs2_journal_lock *lock;
-       struct inode *inode;
-
-       list_for_each_safe(p, n, &(handle->locks)) {
-               lock = list_entry(p, struct ocfs2_journal_lock,
-                                 jl_lock_list);
-               list_del(&lock->jl_lock_list);
-               handle->num_locks--;
-
-               inode = lock->jl_inode;
-               ocfs2_meta_unlock(inode, 1);
-               if (atomic_read(&inode->i_count) == 1)
-                       mlog(ML_ERROR,
-                            "Inode %llu, I'm doing a last iput for!",
-                            (unsigned long long)OCFS2_I(inode)->ip_blkno);
-               iput(inode);
-               kmem_cache_free(ocfs2_lock_cache, lock);
-       }
-}
-
 #define OCFS2_DEFAULT_COMMIT_INTERVAL  (HZ * 5)
 
 void ocfs2_set_journal_params(struct ocfs2_super *osb)
@@ -500,8 +423,7 @@ int ocfs2_journal_init(struct ocfs2_journal *journal, int *dirty)
        /* Skip recovery waits here - journal inode metadata never
         * changes in a live cluster so it can be considered an
         * exception to the rule. */
-       status = ocfs2_meta_lock_full(inode, NULL, &bh, 1,
-                                     OCFS2_META_LOCK_RECOVERY);
+       status = ocfs2_meta_lock_full(inode, &bh, 1, OCFS2_META_LOCK_RECOVERY);
        if (status < 0) {
                if (status != -ERESTARTSYS)
                        mlog(ML_ERROR, "Could not get lock on journal!\n");
@@ -1098,8 +1020,7 @@ static int ocfs2_replay_journal(struct ocfs2_super *osb,
        }
        SET_INODE_JOURNAL(inode);
 
-       status = ocfs2_meta_lock_full(inode, NULL, &bh, 1,
-                                     OCFS2_META_LOCK_RECOVERY);
+       status = ocfs2_meta_lock_full(inode, &bh, 1, OCFS2_META_LOCK_RECOVERY);
        if (status < 0) {
                mlog(0, "status returned from ocfs2_meta_lock=%d\n", status);
                if (status != -ERESTARTSYS)
@@ -1288,7 +1209,7 @@ static int ocfs2_trylock_journal(struct ocfs2_super *osb,
        SET_INODE_JOURNAL(inode);
 
        flags = OCFS2_META_LOCK_RECOVERY | OCFS2_META_LOCK_NOQUEUE;
-       status = ocfs2_meta_lock_full(inode, NULL, NULL, 1, flags);
+       status = ocfs2_meta_lock_full(inode, NULL, 1, flags);
        if (status < 0) {
                if (status != -EAGAIN)
                        mlog_errno(status);
@@ -1371,7 +1292,7 @@ static int ocfs2_queue_orphans(struct ocfs2_super *osb,
        }       
 
        mutex_lock(&orphan_dir_inode->i_mutex);
-       status = ocfs2_meta_lock(orphan_dir_inode, NULL, NULL, 0);
+       status = ocfs2_meta_lock(orphan_dir_inode, NULL, 0);
        if (status < 0) {
                mlog_errno(status);
                goto out;