jbd2: clear revoked flag on buffers before a new transaction started
[firefly-linux-kernel-4.4.55.git] / fs / jbd2 / commit.c
index eef6979821a4c8db91f48854c46f81c291ef4c27..5069b84751509e65bb9689c153ac87e36c26b843 100644 (file)
@@ -352,7 +352,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
        J_ASSERT(commit_transaction->t_state == T_RUNNING);
 
        trace_jbd2_start_commit(journal, commit_transaction);
-       jbd_debug(1, "JBD: starting commit of transaction %d\n",
+       jbd_debug(1, "JBD2: starting commit of transaction %d\n",
                        commit_transaction->t_tid);
 
        write_lock(&journal->j_state_lock);
@@ -427,7 +427,13 @@ void jbd2_journal_commit_transaction(journal_t *journal)
        __jbd2_journal_clean_checkpoint_list(journal);
        spin_unlock(&journal->j_list_lock);
 
-       jbd_debug (3, "JBD: commit phase 1\n");
+       jbd_debug(3, "JBD2: commit phase 1\n");
+
+       /*
+        * Clear revoked flag to reflect there is no revoked buffers
+        * in the next transaction which is going to be started.
+        */
+       jbd2_clear_buffer_revoked_flags(journal);
 
        /*
         * Switch to a new revoke table.
@@ -447,7 +453,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
        wake_up(&journal->j_wait_transaction_locked);
        write_unlock(&journal->j_state_lock);
 
-       jbd_debug (3, "JBD: commit phase 2\n");
+       jbd_debug(3, "JBD2: commit phase 2\n");
 
        /*
         * Now start flushing things to disk, in the order they appear
@@ -462,7 +468,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
                                          WRITE_SYNC);
        blk_finish_plug(&plug);
 
-       jbd_debug(3, "JBD: commit phase 2\n");
+       jbd_debug(3, "JBD2: commit phase 2\n");
 
        /*
         * Way to go: we have now written out all of the data for a
@@ -522,7 +528,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
 
                        J_ASSERT (bufs == 0);
 
-                       jbd_debug(4, "JBD: get descriptor\n");
+                       jbd_debug(4, "JBD2: get descriptor\n");
 
                        descriptor = jbd2_journal_get_descriptor_buffer(journal);
                        if (!descriptor) {
@@ -531,7 +537,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
                        }
 
                        bh = jh2bh(descriptor);
-                       jbd_debug(4, "JBD: got buffer %llu (%p)\n",
+                       jbd_debug(4, "JBD2: got buffer %llu (%p)\n",
                                (unsigned long long)bh->b_blocknr, bh->b_data);
                        header = (journal_header_t *)&bh->b_data[0];
                        header->h_magic     = cpu_to_be32(JBD2_MAGIC_NUMBER);
@@ -625,7 +631,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
                    commit_transaction->t_buffers == NULL ||
                    space_left < tag_bytes + 16) {
 
-                       jbd_debug(4, "JBD: Submit %d IOs\n", bufs);
+                       jbd_debug(4, "JBD2: Submit %d IOs\n", bufs);
 
                        /* Write an end-of-descriptor marker before
                            submitting the IOs.  "tag" still points to
@@ -707,7 +713,7 @@ start_journal_io:
           so we incur less scheduling load.
        */
 
-       jbd_debug(3, "JBD: commit phase 3\n");
+       jbd_debug(3, "JBD2: commit phase 3\n");
 
        /*
         * akpm: these are BJ_IO, and j_list_lock is not needed.
@@ -771,7 +777,7 @@ wait_for_iobuf:
 
        J_ASSERT (commit_transaction->t_shadow_list == NULL);
 
-       jbd_debug(3, "JBD: commit phase 4\n");
+       jbd_debug(3, "JBD2: commit phase 4\n");
 
        /* Here we wait for the revoke record and descriptor record buffers */
  wait_for_ctlbuf:
@@ -801,7 +807,7 @@ wait_for_iobuf:
        if (err)
                jbd2_journal_abort(journal, err);
 
-       jbd_debug(3, "JBD: commit phase 5\n");
+       jbd_debug(3, "JBD2: commit phase 5\n");
        write_lock(&journal->j_state_lock);
        J_ASSERT(commit_transaction->t_state == T_COMMIT_DFLUSH);
        commit_transaction->t_state = T_COMMIT_JFLUSH;
@@ -830,7 +836,7 @@ wait_for_iobuf:
            transaction can be removed from any checkpoint list it was on
            before. */
 
-       jbd_debug(3, "JBD: commit phase 6\n");
+       jbd_debug(3, "JBD2: commit phase 6\n");
 
        J_ASSERT(list_empty(&commit_transaction->t_inode_list));
        J_ASSERT(commit_transaction->t_buffers == NULL);
@@ -964,7 +970,7 @@ restart_loop:
 
        /* Done with this transaction! */
 
-       jbd_debug(3, "JBD: commit phase 7\n");
+       jbd_debug(3, "JBD2: commit phase 7\n");
 
        J_ASSERT(commit_transaction->t_state == T_COMMIT_JFLUSH);
 
@@ -1039,7 +1045,7 @@ restart_loop:
                journal->j_commit_callback(journal, commit_transaction);
 
        trace_jbd2_end_commit(journal, commit_transaction);
-       jbd_debug(1, "JBD: commit %d complete, head %d\n",
+       jbd_debug(1, "JBD2: commit %d complete, head %d\n",
                  journal->j_commit_sequence, journal->j_tail_sequence);
        if (to_free)
                kfree(commit_transaction);