sysv: replace inode uid,gid,mode initialization with helper function
[safe/jmp/linux-2.6] / fs / jbd2 / recovery.c
index 9216806..049281b 100644 (file)
@@ -20,7 +20,6 @@
 #include <linux/fs.h>
 #include <linux/jbd2.h>
 #include <linux/errno.h>
-#include <linux/slab.h>
 #include <linux/crc32.h>
 #endif
 
@@ -225,7 +224,7 @@ do {                                                                        \
  */
 int jbd2_journal_recover(journal_t *journal)
 {
-       int                     err;
+       int                     err, err2;
        journal_superblock_t *  sb;
 
        struct recovery_info    info;
@@ -263,7 +262,10 @@ int jbd2_journal_recover(journal_t *journal)
        journal->j_transaction_sequence = ++info.end_transaction;
 
        jbd2_journal_clear_revoke(journal);
-       sync_blockdev(journal->j_fs_dev);
+       err2 = sync_blockdev(journal->j_fs_dev);
+       if (!err)
+               err = err2;
+
        return err;
 }
 
@@ -344,6 +346,7 @@ static int calc_chksums(journal_t *journal, struct buffer_head *bh,
                        *crc32_sum = crc32_be(*crc32_sum, (void *)obh->b_data,
                                     obh->b_size);
                }
+               put_bh(obh);
        }
        return 0;
 }
@@ -397,7 +400,7 @@ static int do_one_pass(journal_t *journal,
                struct buffer_head *    obh;
                struct buffer_head *    nbh;
 
-               cond_resched();         /* We're under lock_kernel() */
+               cond_resched();
 
                /* If we already know where to stop the log traversal,
                 * check right now that we haven't gone past the end of
@@ -535,7 +538,7 @@ static int do_one_pass(journal_t *journal,
                                        memcpy(nbh->b_data, obh->b_data,
                                                        journal->j_blocksize);
                                        if (flags & JBD2_FLAG_ESCAPE) {
-                                               *((__be32 *)bh->b_data) =
+                                               *((__be32 *)nbh->b_data) =
                                                cpu_to_be32(JBD2_MAGIC_NUMBER);
                                        }
 
@@ -610,9 +613,8 @@ static int do_one_pass(journal_t *journal,
                                chksum_err = chksum_seen = 0;
 
                                if (info->end_transaction) {
-                                       printk(KERN_ERR "JBD: Transaction %u "
-                                               "found to be corrupt.\n",
-                                               next_commit_ID - 1);
+                                       journal->j_failed_commit =
+                                               info->end_transaction;
                                        brelse(bh);
                                        break;
                                }
@@ -641,12 +643,10 @@ static int do_one_pass(journal_t *journal,
                                if (chksum_err) {
                                        info->end_transaction = next_commit_ID;
 
-                                       if (!JBD2_HAS_COMPAT_FEATURE(journal,
+                                       if (!JBD2_HAS_INCOMPAT_FEATURE(journal,
                                           JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)){
-                                               printk(KERN_ERR
-                                                      "JBD: Transaction %u "
-                                                      "found to be corrupt.\n",
-                                                      next_commit_ID);
+                                               journal->j_failed_commit =
+                                                       next_commit_ID;
                                                brelse(bh);
                                                break;
                                        }