]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - fs/jbd/journal.c
jbd: Add fixed tracepoints
[karo-tx-linux.git] / fs / jbd / journal.c
index b3713afaaa9e698337b40c7e1fecac6afbebc1bf..ab019ee77888eb216455c231916371a6ce2f187c 100644 (file)
@@ -38,6 +38,9 @@
 #include <linux/debugfs.h>
 #include <linux/ratelimit.h>
 
+#define CREATE_TRACE_POINTS
+#include <trace/events/jbd.h>
+
 #include <asm/uaccess.h>
 #include <asm/page.h>
 
@@ -437,9 +440,12 @@ int __log_space_left(journal_t *journal)
 int __log_start_commit(journal_t *journal, tid_t target)
 {
        /*
-        * Are we already doing a recent enough commit?
+        * The only transaction we can possibly wait upon is the
+        * currently running transaction (if it exists).  Otherwise,
+        * the target tid must be an old one.
         */
-       if (!tid_geq(journal->j_commit_request, target)) {
+       if (journal->j_running_transaction &&
+           journal->j_running_transaction->t_tid == target) {
                /*
                 * We want a new commit: OK, mark the request and wakeup the
                 * commit thread.  We do _not_ do the commit ourselves.
@@ -451,7 +457,14 @@ int __log_start_commit(journal_t *journal, tid_t target)
                          journal->j_commit_sequence);
                wake_up(&journal->j_wait_commit);
                return 1;
-       }
+       } else if (!tid_geq(journal->j_commit_request, target))
+               /* This should never happen, but if it does, preserve
+                  the evidence before kjournald goes into a loop and
+                  increments j_commit_sequence beyond all recognition. */
+               WARN_ONCE(1, "jbd: bad log_start_commit: %u %u %u %u\n",
+                   journal->j_commit_request, journal->j_commit_sequence,
+                   target, journal->j_running_transaction ?
+                   journal->j_running_transaction->t_tid : 0);
        return 0;
 }
 
@@ -1055,6 +1068,7 @@ void journal_update_superblock(journal_t *journal, int wait)
        } else
                write_dirty_buffer(bh, WRITE);
 
+       trace_jbd_update_superblock_end(journal, wait);
 out:
        /* If we have just flushed the log (by marking s_start==0), then
         * any future commit will have to be careful to update the