timerfd: support CLOCK_BOOTTIME clock
[linux-3.10.git] / fs / jbd / recovery.c
index cb1a49a..a748fe2 100644 (file)
@@ -20,7 +20,7 @@
 #include <linux/fs.h>
 #include <linux/jbd.h>
 #include <linux/errno.h>
-#include <linux/slab.h>
+#include <linux/blkdev.h>
 #endif
 
 /*
@@ -264,6 +264,12 @@ int journal_recover(journal_t *journal)
        err2 = sync_blockdev(journal->j_fs_dev);
        if (!err)
                err = err2;
+       /* Flush disk caches to get replayed data on the permanent storage */
+       if (journal->j_flags & JFS_BARRIER) {
+               err2 = blkdev_issue_flush(journal->j_fs_dev, GFP_KERNEL, NULL);
+               if (!err)
+                       err = err2;
+       }
 
        return err;
 }
@@ -284,12 +290,9 @@ int journal_recover(journal_t *journal)
 int journal_skip_recovery(journal_t *journal)
 {
        int                     err;
-       journal_superblock_t *  sb;
-
        struct recovery_info    info;
 
        memset (&info, 0, sizeof(info));
-       sb = journal->j_superblock;
 
        err = do_one_pass(journal, &info, PASS_SCAN);
 
@@ -298,11 +301,12 @@ int journal_skip_recovery(journal_t *journal)
                ++journal->j_transaction_sequence;
        } else {
 #ifdef CONFIG_JBD_DEBUG
-               int dropped = info.end_transaction - be32_to_cpu(sb->s_sequence);
-#endif
+               int dropped = info.end_transaction -
+                             be32_to_cpu(journal->j_superblock->s_sequence);
                jbd_debug(1,
                          "JBD: ignoring %d transaction%s from the journal.\n",
                          dropped, (dropped == 1) ? "" : "s");
+#endif
                journal->j_transaction_sequence = ++info.end_transaction;
        }
 
@@ -322,11 +326,6 @@ static int do_one_pass(journal_t *journal,
        unsigned int            sequence;
        int                     blocktype;
 
-       /* Precompute the maximum metadata descriptors in a descriptor block */
-       int                     MAX_BLOCKS_PER_DESC;
-       MAX_BLOCKS_PER_DESC = ((journal->j_blocksize-sizeof(journal_header_t))
-                              / sizeof(journal_block_tag_t));
-
        /*
         * First thing is to establish what we expect to find in the log
         * (in terms of transaction IDs), and where (in terms of log