]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
recovery.c, jfs_user.h: Sync recovery.c with latest 2.5 kernel
authorTheodore Ts'o <tytso@mit.edu>
Sun, 7 Dec 2003 06:00:02 +0000 (01:00 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 7 Dec 2003 06:00:02 +0000 (01:00 -0500)
version.

e2fsck/ChangeLog
e2fsck/jfs_user.h
e2fsck/recovery.c

index 5c9427b5ee0054b1062a8aa1ade7989c91dac08d..b97949c1951004f9fc5179c1fdeba7bca38a3119 100644 (file)
@@ -1,3 +1,8 @@
+2003-12-07  Theodore Ts'o  <tytso@mit.edu>
+
+       * recovery.c, jfs_user.h: Sync recovery.c with latest 2.5 kernel
+               version.
+
 2003-12-02  Theodore Ts'o  <tytso@mit.edu>
 
        * unix.c (main): When testing a disk using e2fsck -c, use the list
index d8da03037b953d43aae8ab56ea36de38bd484b87..157ece18e1f72c5db583d075fea38d95191874e0 100644 (file)
@@ -42,6 +42,9 @@ struct kdev_s {
 typedef struct kdev_s *kdev_t;
 
 #define fsync_no_super(dev) do {} while(0)
+#define sync_blockdev(dev) do {} while(0)
+#define lock_buffer(bh) do {} while(0)
+#define unlock_buffer(bh) do {} while(0)
 #define buffer_req(bh) 1
 #define do_readahead(journal, start) do {} while(0)
        
@@ -110,3 +113,9 @@ void mark_buffer_uptodate(struct buffer_head *bh, int val);
 void brelse(struct buffer_head *bh);
 int buffer_uptodate(struct buffer_head *bh);
 void wait_on_buffer(struct buffer_head *bh);
+
+/*
+ * Define newer 2.5 interfaces
+ */
+#define __getblk(dev, blocknr, blocksize) getblk(dev, blocknr, blocksize)
+#define set_buffer_uptodate(bh) mark_buffer_uptodate(bh, 1)
index e8e416306aed8fdb62109757c5aab5c3e7f35877..b37badf07e9b6fc3818329ad912f1f84eec46635 100644 (file)
 #ifndef __KERNEL__
 #include "jfs_user.h"
 #else
-#include <linux/sched.h>
+#include <linux/time.h>
 #include <linux/fs.h>
 #include <linux/jbd.h>
 #include <linux/errno.h>
 #include <linux/slab.h>
-#include <linux/locks.h>
 #endif
 
 /*
@@ -95,7 +94,7 @@ static int do_readahead(journal_t *journal, unsigned int start)
                        goto failed;
                }
 
-               bh = getblk(journal->j_dev, blocknr, journal->j_blocksize);
+               bh = __getblk(journal->j_dev, blocknr, journal->j_blocksize);
                if (!bh) {
                        err = -ENOMEM;
                        goto failed;
@@ -148,7 +147,7 @@ static int jread(struct buffer_head **bhp, journal_t *journal,
                return err;
        }
 
-       bh = getblk(journal->j_dev, blocknr, journal->j_blocksize);
+       bh = __getblk(journal->j_dev, blocknr, journal->j_blocksize);
        if (!bh)
                return -ENOMEM;
 
@@ -207,8 +206,9 @@ do {                                                                        \
                var -= ((journal)->j_last - (journal)->j_first);        \
 } while (0)
 
-/*
- * journal_recover
+/**
+ * int journal_recover(journal_t *journal) - recovers a on-disk journal
+ * @journal: the journal to recover
  *
  * The primary function for recovering the log contents when mounting a
  * journaled device.  
@@ -218,7 +218,6 @@ do {                                                                        \
  * blocks.  In the third and final pass, we replay any un-revoked blocks
  * in the log.  
  */
-
 int journal_recover(journal_t *journal)
 {
        int                     err;
@@ -242,7 +241,6 @@ int journal_recover(journal_t *journal)
                return 0;
        }
        
-
        err = do_one_pass(journal, &info, PASS_SCAN);
        if (!err)
                err = do_one_pass(journal, &info, PASS_REVOKE);
@@ -260,22 +258,23 @@ int journal_recover(journal_t *journal)
        journal->j_transaction_sequence = ++info.end_transaction;
                
        journal_clear_revoke(journal);
-       fsync_no_super(journal->j_fs_dev);
+       sync_blockdev(journal->j_fs_dev);
        return err;
 }
 
-/*
- * journal_skip_recovery
+/**
+ * int journal_skip_recovery() - Start journal and wipe exiting records
+ * @journal: journal to startup
  *
  * Locate any valid recovery information from the journal and set up the
  * journal structures in memory to ignore it (presumably because the
  * caller has evidence that it is out of date).  
+ * This function does'nt appear to be exorted..
  *
  * We perform one pass over the journal to allow us to tell the user how
  * much recovery information is being erased, and to let us initialise
  * the journal transaction sequence numbers to the next unused ID. 
  */
-
 int journal_skip_recovery(journal_t *journal)
 {
        int                     err;
@@ -295,7 +294,6 @@ int journal_skip_recovery(journal_t *journal)
 #ifdef CONFIG_JBD_DEBUG
                int dropped = info.end_transaction - ntohl(sb->s_sequence);
 #endif
-               
                jbd_debug(0, 
                          "JBD: ignoring %d transaction%s from the journal.\n",
                          dropped, (dropped == 1) ? "" : "s");
@@ -303,14 +301,12 @@ int journal_skip_recovery(journal_t *journal)
        }
 
        journal->j_tail = 0;
-       
        return err;
 }
 
 static int do_one_pass(journal_t *journal,
                        struct recovery_info *info, enum passtype pass)
 {
-       
        unsigned int            first_commit_ID, next_commit_ID;
        unsigned long           next_log_block;
        int                     err, success = 0;
@@ -460,7 +456,8 @@ static int do_one_pass(journal_t *journal,
                                                                
                                        /* Find a buffer for the new
                                         * data being restored */
-                                       nbh = getblk(journal->j_fs_dev, blocknr,
+                                       nbh = __getblk(journal->j_fs_dev, 
+                                                      blocknr,
                                                     journal->j_blocksize);
                                        if (nbh == NULL) {
                                                printk(KERN_ERR 
@@ -472,6 +469,7 @@ static int do_one_pass(journal_t *journal,
                                                goto failed;
                                        }
 
+                                       lock_buffer(nbh);
                                        memcpy(nbh->b_data, obh->b_data,
                                                        journal->j_blocksize);
                                        if (flags & JFS_FLAG_ESCAPE) {
@@ -480,11 +478,12 @@ static int do_one_pass(journal_t *journal,
                                        }
 
                                        BUFFER_TRACE(nbh, "marking dirty");
+                                       set_buffer_uptodate(nbh);
                                        mark_buffer_dirty(nbh);
                                        BUFFER_TRACE(nbh, "marking uptodate");
-                                       mark_buffer_uptodate(nbh, 1);
                                        ++info->nr_replays;
                                        /* ll_rw_block(WRITE, 1, &nbh); */
+                                       unlock_buffer(nbh);
                                        brelse(obh);
                                        brelse(nbh);
                                }