]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/ocfs2/journal.c
ocfs2: Move slot map access into slot_map.c
[linux-2.6-omap-h63xx.git] / fs / ocfs2 / journal.c
index 8d81f6c1b877e98a6e9b6a1ad2f5bf6ea5d43a0c..c2e654ee703a44b9b9b8b965770badf82948ce93 100644 (file)
@@ -44,7 +44,6 @@
 #include "localalloc.h"
 #include "slot_map.h"
 #include "super.h"
-#include "vote.h"
 #include "sysfile.h"
 
 #include "buffer_head_io.h"
@@ -103,7 +102,7 @@ static int ocfs2_commit_cache(struct ocfs2_super *osb)
        mlog(0, "commit_thread: flushed transaction %lu (%u handles)\n",
             journal->j_trans_id, flushed);
 
-       ocfs2_kick_vote_thread(osb);
+       ocfs2_wake_downconvert_thread(osb);
        wake_up(&journal->j_checkpointed);
 finally:
        mlog_exit(status);
@@ -314,14 +313,18 @@ int ocfs2_journal_dirty_data(handle_t *handle,
        return err;
 }
 
-#define OCFS2_DEFAULT_COMMIT_INTERVAL  (HZ * 5)
+#define OCFS2_DEFAULT_COMMIT_INTERVAL  (HZ * JBD_DEFAULT_MAX_COMMIT_AGE)
 
 void ocfs2_set_journal_params(struct ocfs2_super *osb)
 {
        journal_t *journal = osb->journal->j_journal;
+       unsigned long commit_interval = OCFS2_DEFAULT_COMMIT_INTERVAL;
+
+       if (osb->osb_commit_interval)
+               commit_interval = osb->osb_commit_interval;
 
        spin_lock(&journal->j_state_lock);
-       journal->j_commit_interval = OCFS2_DEFAULT_COMMIT_INTERVAL;
+       journal->j_commit_interval = commit_interval;
        if (osb->s_mount_opt & OCFS2_MOUNT_BARRIER)
                journal->j_flags |= JFS_BARRIER;
        else
@@ -337,7 +340,7 @@ int ocfs2_journal_init(struct ocfs2_journal *journal, int *dirty)
        struct ocfs2_dinode *di = NULL;
        struct buffer_head *bh = NULL;
        struct ocfs2_super *osb;
-       int meta_lock = 0;
+       int inode_lock = 0;
 
        mlog_entry_void();
 
@@ -367,14 +370,14 @@ 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, &bh, 1, OCFS2_META_LOCK_RECOVERY);
+       status = ocfs2_inode_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");
                goto done;
        }
 
-       meta_lock = 1;
+       inode_lock = 1;
        di = (struct ocfs2_dinode *)bh->b_data;
 
        if (inode->i_size <  OCFS2_MIN_JOURNAL_SIZE) {
@@ -414,8 +417,8 @@ int ocfs2_journal_init(struct ocfs2_journal *journal, int *dirty)
        status = 0;
 done:
        if (status < 0) {
-               if (meta_lock)
-                       ocfs2_meta_unlock(inode, 1);
+               if (inode_lock)
+                       ocfs2_inode_unlock(inode, 1);
                if (bh != NULL)
                        brelse(bh);
                if (inode) {
@@ -544,7 +547,7 @@ void ocfs2_journal_shutdown(struct ocfs2_super *osb)
        OCFS2_I(inode)->ip_open_count--;
 
        /* unlock our journal */
-       ocfs2_meta_unlock(inode, 1);
+       ocfs2_inode_unlock(inode, 1);
 
        brelse(journal->j_bh);
        journal->j_bh = NULL;
@@ -883,8 +886,8 @@ restart:
        ocfs2_super_unlock(osb, 1);
 
        /* We always run recovery on our own orphan dir - the dead
-        * node(s) may have voted "no" on an inode delete earlier. A
-        * revote is therefore required. */
+        * node(s) may have disallowd a previos inode delete. Re-processing
+        * is therefore required. */
        ocfs2_queue_recovery_completion(osb->journal, osb->slot_num, NULL,
                                        NULL);
 
@@ -973,9 +976,9 @@ static int ocfs2_replay_journal(struct ocfs2_super *osb,
        }
        SET_INODE_JOURNAL(inode);
 
-       status = ocfs2_meta_lock_full(inode, &bh, 1, OCFS2_META_LOCK_RECOVERY);
+       status = ocfs2_inode_lock_full(inode, &bh, 1, OCFS2_META_LOCK_RECOVERY);
        if (status < 0) {
-               mlog(0, "status returned from ocfs2_meta_lock=%d\n", status);
+               mlog(0, "status returned from ocfs2_inode_lock=%d\n", status);
                if (status != -ERESTARTSYS)
                        mlog(ML_ERROR, "Could not lock journal!\n");
                goto done;
@@ -1047,7 +1050,7 @@ static int ocfs2_replay_journal(struct ocfs2_super *osb,
 done:
        /* drop the lock on this nodes journal */
        if (got_lock)
-               ocfs2_meta_unlock(inode, 1);
+               ocfs2_inode_unlock(inode, 1);
 
        if (inode)
                iput(inode);
@@ -1120,8 +1123,7 @@ static int ocfs2_recover_node(struct ocfs2_super *osb,
 
        /* Likewise, this would be a strange but ultimately not so
         * harmful place to get an error... */
-       ocfs2_clear_slot(si, slot_num);
-       status = ocfs2_update_disk_slots(osb, si);
+       status = ocfs2_clear_slot(osb, slot_num);
        if (status < 0)
                mlog_errno(status);
 
@@ -1162,14 +1164,14 @@ 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, 1, flags);
+       status = ocfs2_inode_lock_full(inode, NULL, 1, flags);
        if (status < 0) {
                if (status != -EAGAIN)
                        mlog_errno(status);
                goto bail;
        }
 
-       ocfs2_meta_unlock(inode, 1);
+       ocfs2_inode_unlock(inode, 1);
 bail:
        if (inode)
                iput(inode);
@@ -1241,7 +1243,7 @@ static int ocfs2_orphan_filldir(void *priv, const char *name, int name_len,
 
        /* Skip bad inodes so that recovery can continue */
        iter = ocfs2_iget(p->osb, ino,
-                         OCFS2_FI_FLAG_ORPHAN_RECOVERY);
+                         OCFS2_FI_FLAG_ORPHAN_RECOVERY, 0);
        if (IS_ERR(iter))
                return 0;
 
@@ -1277,7 +1279,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, 0);
+       status = ocfs2_inode_lock(orphan_dir_inode, NULL, 0);
        if (status < 0) {
                mlog_errno(status);
                goto out;
@@ -1293,7 +1295,7 @@ static int ocfs2_queue_orphans(struct ocfs2_super *osb,
        *head = priv.head;
 
 out_cluster:
-       ocfs2_meta_unlock(orphan_dir_inode, 0);
+       ocfs2_inode_unlock(orphan_dir_inode, 0);
 out:
        mutex_unlock(&orphan_dir_inode->i_mutex);
        iput(orphan_dir_inode);
@@ -1380,10 +1382,10 @@ static int ocfs2_recover_orphans(struct ocfs2_super *osb,
                iter = oi->ip_next_orphan;
 
                spin_lock(&oi->ip_lock);
-               /* Delete voting may have set these on the assumption
-                * that the other node would wipe them successfully.
-                * If they are still in the node's orphan dir, we need
-                * to reset that state. */
+               /* The remote delete code may have set these on the
+                * assumption that the other node would wipe them
+                * successfully.  If they are still in the node's
+                * orphan dir, we need to reset that state. */
                oi->ip_flags &= ~(OCFS2_INODE_DELETED|OCFS2_INODE_SKIP_DELETE);
 
                /* Set the proper information to get us going into