summaryrefslogtreecommitdiff
path: root/e2fsck
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2003-12-07 01:00:02 -0500
committerTheodore Ts'o <tytso@mit.edu>2003-12-07 01:00:02 -0500
commit3de085dd4109e6a7049dd6b85abf0313167cab5b (patch)
tree0d204161ec39aa77888f448a9e3daf9784f859bf /e2fsck
parent3ddf2f662eaccf2376dd99c65a2fe93fcf75c3e7 (diff)
downloade2fsprogs-3de085dd4109e6a7049dd6b85abf0313167cab5b.tar.gz
recovery.c, jfs_user.h: Sync recovery.c with latest 2.5 kernel
version.
Diffstat (limited to 'e2fsck')
-rw-r--r--e2fsck/ChangeLog5
-rw-r--r--e2fsck/jfs_user.h9
-rw-r--r--e2fsck/recovery.c33
3 files changed, 30 insertions, 17 deletions
diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog
index 5c9427b5..b97949c1 100644
--- a/e2fsck/ChangeLog
+++ b/e2fsck/ChangeLog
@@ -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
diff --git a/e2fsck/jfs_user.h b/e2fsck/jfs_user.h
index d8da0303..157ece18 100644
--- a/e2fsck/jfs_user.h
+++ b/e2fsck/jfs_user.h
@@ -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)
diff --git a/e2fsck/recovery.c b/e2fsck/recovery.c
index e8e41630..b37badf0 100644
--- a/e2fsck/recovery.c
+++ b/e2fsck/recovery.c
@@ -16,12 +16,11 @@
#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);
}