aboutsummaryrefslogtreecommitdiff
path: root/fs/jbd2
diff options
context:
space:
mode:
authorMingming Cao <cmm@us.ibm.com>2006-10-11 01:21:09 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-11 11:14:17 -0700
commit299717696d48531d70aeb4614c3939e4a28456c1 (patch)
treed63c05b0192e480917c48126b2ac7c0f74d08018 /fs/jbd2
parentb517bea1c74e4773482b3f41b3f493522a8c8e30 (diff)
[PATCH] jbd2: sector_t conversion
JBD layer in-kernel block varibles type fixes to support >32 bit block number and convert to sector_t type. Signed-off-by: Mingming Cao <cmm@us.ibm.com> Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/jbd2')
-rw-r--r--fs/jbd2/commit.c2
-rw-r--r--fs/jbd2/journal.c18
-rw-r--r--fs/jbd2/recovery.c8
-rw-r--r--fs/jbd2/revoke.c23
4 files changed, 26 insertions, 25 deletions
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
index 44d68a113c7..1a9ce888522 100644
--- a/fs/jbd2/commit.c
+++ b/fs/jbd2/commit.c
@@ -293,7 +293,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
int bufs;
int flags;
int err;
- unsigned long blocknr;
+ sector_t blocknr;
char *tagp = NULL;
journal_header_t *header;
journal_block_tag_t *tag = NULL;
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index 926ebcbf8a7..259e8365ea1 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -271,7 +271,7 @@ static void journal_kill_thread(journal_t *journal)
int jbd2_journal_write_metadata_buffer(transaction_t *transaction,
struct journal_head *jh_in,
struct journal_head **jh_out,
- unsigned long blocknr)
+ sector_t blocknr)
{
int need_copy_out = 0;
int done_copy_out = 0;
@@ -555,7 +555,7 @@ int jbd2_log_wait_commit(journal_t *journal, tid_t tid)
* Log buffer allocation routines:
*/
-int jbd2_journal_next_log_block(journal_t *journal, unsigned long *retp)
+int jbd2_journal_next_log_block(journal_t *journal, sector_t *retp)
{
unsigned long blocknr;
@@ -579,10 +579,10 @@ int jbd2_journal_next_log_block(journal_t *journal, unsigned long *retp)
* ready.
*/
int jbd2_journal_bmap(journal_t *journal, unsigned long blocknr,
- unsigned long *retp)
+ sector_t *retp)
{
int err = 0;
- unsigned long ret;
+ sector_t ret;
if (journal->j_inode) {
ret = bmap(journal->j_inode, blocknr);
@@ -618,7 +618,7 @@ int jbd2_journal_bmap(journal_t *journal, unsigned long blocknr,
struct journal_head *jbd2_journal_get_descriptor_buffer(journal_t *journal)
{
struct buffer_head *bh;
- unsigned long blocknr;
+ sector_t blocknr;
int err;
err = jbd2_journal_next_log_block(journal, &blocknr);
@@ -706,7 +706,7 @@ fail:
*/
journal_t * jbd2_journal_init_dev(struct block_device *bdev,
struct block_device *fs_dev,
- int start, int len, int blocksize)
+ sector_t start, int len, int blocksize)
{
journal_t *journal = journal_init_common();
struct buffer_head *bh;
@@ -753,7 +753,7 @@ journal_t * jbd2_journal_init_inode (struct inode *inode)
journal_t *journal = journal_init_common();
int err;
int n;
- unsigned long blocknr;
+ sector_t blocknr;
if (!journal)
return NULL;
@@ -819,7 +819,7 @@ static void journal_fail_superblock (journal_t *journal)
static int journal_reset(journal_t *journal)
{
journal_superblock_t *sb = journal->j_superblock;
- unsigned long first, last;
+ sector_t first, last;
first = be32_to_cpu(sb->s_first);
last = be32_to_cpu(sb->s_maxlen);
@@ -853,7 +853,7 @@ static int journal_reset(journal_t *journal)
**/
int jbd2_journal_create(journal_t *journal)
{
- unsigned long blocknr;
+ sector_t blocknr;
struct buffer_head *bh;
journal_superblock_t *sb;
int i, err;
diff --git a/fs/jbd2/recovery.c b/fs/jbd2/recovery.c
index 2486843adda..52054a83e71 100644
--- a/fs/jbd2/recovery.c
+++ b/fs/jbd2/recovery.c
@@ -70,7 +70,7 @@ static int do_readahead(journal_t *journal, unsigned int start)
{
int err;
unsigned int max, nbufs, next;
- unsigned long blocknr;
+ sector_t blocknr;
struct buffer_head *bh;
struct buffer_head * bufs[MAXBUF];
@@ -132,7 +132,7 @@ static int jread(struct buffer_head **bhp, journal_t *journal,
unsigned int offset)
{
int err;
- unsigned long blocknr;
+ sector_t blocknr;
struct buffer_head *bh;
*bhp = NULL;
@@ -452,7 +452,7 @@ static int do_one_pass(journal_t *journal,
"block %ld in log\n",
err, io_block);
} else {
- unsigned long blocknr;
+ sector_t blocknr;
J_ASSERT(obh != NULL);
blocknr = read_tag_block(tag_bytes,
@@ -592,7 +592,7 @@ static int scan_revoke_records(journal_t *journal, struct buffer_head *bh,
record_len = 8;
while (offset + record_len <= max) {
- unsigned long blocknr;
+ sector_t blocknr;
int err;
if (record_len == 4)
diff --git a/fs/jbd2/revoke.c b/fs/jbd2/revoke.c
index 8aac875bd30..3310a1d7ace 100644
--- a/fs/jbd2/revoke.c
+++ b/fs/jbd2/revoke.c
@@ -81,7 +81,7 @@ struct jbd2_revoke_record_s
{
struct list_head hash;
tid_t sequence; /* Used for recovery only */
- unsigned long blocknr;
+ sector_t blocknr;
};
@@ -106,17 +106,18 @@ static void flush_descriptor(journal_t *, struct journal_head *, int);
/* Utility functions to maintain the revoke table */
/* Borrowed from buffer.c: this is a tried and tested block hash function */
-static inline int hash(journal_t *journal, unsigned long block)
+static inline int hash(journal_t *journal, sector_t block)
{
struct jbd2_revoke_table_s *table = journal->j_revoke;
int hash_shift = table->hash_shift;
+ int hash = (int)block ^ (int)((block >> 31) >> 1);
- return ((block << (hash_shift - 6)) ^
- (block >> 13) ^
- (block << (hash_shift - 12))) & (table->hash_size - 1);
+ return ((hash << (hash_shift - 6)) ^
+ (hash >> 13) ^
+ (hash << (hash_shift - 12))) & (table->hash_size - 1);
}
-static int insert_revoke_hash(journal_t *journal, unsigned long blocknr,
+static int insert_revoke_hash(journal_t *journal, sector_t blocknr,
tid_t seq)
{
struct list_head *hash_list;
@@ -146,7 +147,7 @@ oom:
/* Find a revoke record in the journal's hash table. */
static struct jbd2_revoke_record_s *find_revoke_record(journal_t *journal,
- unsigned long blocknr)
+ sector_t blocknr)
{
struct list_head *hash_list;
struct jbd2_revoke_record_s *record;
@@ -325,7 +326,7 @@ void jbd2_journal_destroy_revoke(journal_t *journal)
* by one.
*/
-int jbd2_journal_revoke(handle_t *handle, unsigned long blocknr,
+int jbd2_journal_revoke(handle_t *handle, sector_t blocknr,
struct buffer_head *bh_in)
{
struct buffer_head *bh = NULL;
@@ -394,7 +395,7 @@ int jbd2_journal_revoke(handle_t *handle, unsigned long blocknr,
}
}
- jbd_debug(2, "insert revoke for block %lu, bh_in=%p\n", blocknr, bh_in);
+ jbd_debug(2, "insert revoke for block %llu, bh_in=%p\n",blocknr, bh_in);
err = insert_revoke_hash(journal, blocknr,
handle->h_transaction->t_tid);
BUFFER_TRACE(bh_in, "exit");
@@ -649,7 +650,7 @@ static void flush_descriptor(journal_t *journal,
*/
int jbd2_journal_set_revoke(journal_t *journal,
- unsigned long blocknr,
+ sector_t blocknr,
tid_t sequence)
{
struct jbd2_revoke_record_s *record;
@@ -673,7 +674,7 @@ int jbd2_journal_set_revoke(journal_t *journal,
*/
int jbd2_journal_test_revoke(journal_t *journal,
- unsigned long blocknr,
+ sector_t blocknr,
tid_t sequence)
{
struct jbd2_revoke_record_s *record;