Commit 29971769 authored by Mingming Cao's avatar Mingming Cao Committed by Linus Torvalds

[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: default avatarMingming Cao <cmm@us.ibm.com>
Signed-off-by: default avatarDave Kleikamp <shaggy@austin.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent b517bea1
...@@ -293,7 +293,7 @@ void jbd2_journal_commit_transaction(journal_t *journal) ...@@ -293,7 +293,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
int bufs; int bufs;
int flags; int flags;
int err; int err;
unsigned long blocknr; sector_t blocknr;
char *tagp = NULL; char *tagp = NULL;
journal_header_t *header; journal_header_t *header;
journal_block_tag_t *tag = NULL; journal_block_tag_t *tag = NULL;
......
...@@ -271,7 +271,7 @@ static void journal_kill_thread(journal_t *journal) ...@@ -271,7 +271,7 @@ static void journal_kill_thread(journal_t *journal)
int jbd2_journal_write_metadata_buffer(transaction_t *transaction, int jbd2_journal_write_metadata_buffer(transaction_t *transaction,
struct journal_head *jh_in, struct journal_head *jh_in,
struct journal_head **jh_out, struct journal_head **jh_out,
unsigned long blocknr) sector_t blocknr)
{ {
int need_copy_out = 0; int need_copy_out = 0;
int done_copy_out = 0; int done_copy_out = 0;
...@@ -555,7 +555,7 @@ int jbd2_log_wait_commit(journal_t *journal, tid_t tid) ...@@ -555,7 +555,7 @@ int jbd2_log_wait_commit(journal_t *journal, tid_t tid)
* Log buffer allocation routines: * 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; unsigned long blocknr;
...@@ -579,10 +579,10 @@ int jbd2_journal_next_log_block(journal_t *journal, unsigned long *retp) ...@@ -579,10 +579,10 @@ int jbd2_journal_next_log_block(journal_t *journal, unsigned long *retp)
* ready. * ready.
*/ */
int jbd2_journal_bmap(journal_t *journal, unsigned long blocknr, int jbd2_journal_bmap(journal_t *journal, unsigned long blocknr,
unsigned long *retp) sector_t *retp)
{ {
int err = 0; int err = 0;
unsigned long ret; sector_t ret;
if (journal->j_inode) { if (journal->j_inode) {
ret = bmap(journal->j_inode, blocknr); ret = bmap(journal->j_inode, blocknr);
...@@ -618,7 +618,7 @@ int jbd2_journal_bmap(journal_t *journal, unsigned long 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 journal_head *jbd2_journal_get_descriptor_buffer(journal_t *journal)
{ {
struct buffer_head *bh; struct buffer_head *bh;
unsigned long blocknr; sector_t blocknr;
int err; int err;
err = jbd2_journal_next_log_block(journal, &blocknr); err = jbd2_journal_next_log_block(journal, &blocknr);
...@@ -706,7 +706,7 @@ fail: ...@@ -706,7 +706,7 @@ fail:
*/ */
journal_t * jbd2_journal_init_dev(struct block_device *bdev, journal_t * jbd2_journal_init_dev(struct block_device *bdev,
struct block_device *fs_dev, struct block_device *fs_dev,
int start, int len, int blocksize) sector_t start, int len, int blocksize)
{ {
journal_t *journal = journal_init_common(); journal_t *journal = journal_init_common();
struct buffer_head *bh; struct buffer_head *bh;
...@@ -753,7 +753,7 @@ journal_t * jbd2_journal_init_inode (struct inode *inode) ...@@ -753,7 +753,7 @@ journal_t * jbd2_journal_init_inode (struct inode *inode)
journal_t *journal = journal_init_common(); journal_t *journal = journal_init_common();
int err; int err;
int n; int n;
unsigned long blocknr; sector_t blocknr;
if (!journal) if (!journal)
return NULL; return NULL;
...@@ -819,7 +819,7 @@ static void journal_fail_superblock (journal_t *journal) ...@@ -819,7 +819,7 @@ static void journal_fail_superblock (journal_t *journal)
static int journal_reset(journal_t *journal) static int journal_reset(journal_t *journal)
{ {
journal_superblock_t *sb = journal->j_superblock; journal_superblock_t *sb = journal->j_superblock;
unsigned long first, last; sector_t first, last;
first = be32_to_cpu(sb->s_first); first = be32_to_cpu(sb->s_first);
last = be32_to_cpu(sb->s_maxlen); last = be32_to_cpu(sb->s_maxlen);
...@@ -853,7 +853,7 @@ static int journal_reset(journal_t *journal) ...@@ -853,7 +853,7 @@ static int journal_reset(journal_t *journal)
**/ **/
int jbd2_journal_create(journal_t *journal) int jbd2_journal_create(journal_t *journal)
{ {
unsigned long blocknr; sector_t blocknr;
struct buffer_head *bh; struct buffer_head *bh;
journal_superblock_t *sb; journal_superblock_t *sb;
int i, err; int i, err;
......
...@@ -70,7 +70,7 @@ static int do_readahead(journal_t *journal, unsigned int start) ...@@ -70,7 +70,7 @@ static int do_readahead(journal_t *journal, unsigned int start)
{ {
int err; int err;
unsigned int max, nbufs, next; unsigned int max, nbufs, next;
unsigned long blocknr; sector_t blocknr;
struct buffer_head *bh; struct buffer_head *bh;
struct buffer_head * bufs[MAXBUF]; struct buffer_head * bufs[MAXBUF];
...@@ -132,7 +132,7 @@ static int jread(struct buffer_head **bhp, journal_t *journal, ...@@ -132,7 +132,7 @@ static int jread(struct buffer_head **bhp, journal_t *journal,
unsigned int offset) unsigned int offset)
{ {
int err; int err;
unsigned long blocknr; sector_t blocknr;
struct buffer_head *bh; struct buffer_head *bh;
*bhp = NULL; *bhp = NULL;
...@@ -452,7 +452,7 @@ static int do_one_pass(journal_t *journal, ...@@ -452,7 +452,7 @@ static int do_one_pass(journal_t *journal,
"block %ld in log\n", "block %ld in log\n",
err, io_block); err, io_block);
} else { } else {
unsigned long blocknr; sector_t blocknr;
J_ASSERT(obh != NULL); J_ASSERT(obh != NULL);
blocknr = read_tag_block(tag_bytes, blocknr = read_tag_block(tag_bytes,
...@@ -592,7 +592,7 @@ static int scan_revoke_records(journal_t *journal, struct buffer_head *bh, ...@@ -592,7 +592,7 @@ static int scan_revoke_records(journal_t *journal, struct buffer_head *bh,
record_len = 8; record_len = 8;
while (offset + record_len <= max) { while (offset + record_len <= max) {
unsigned long blocknr; sector_t blocknr;
int err; int err;
if (record_len == 4) if (record_len == 4)
......
...@@ -81,7 +81,7 @@ struct jbd2_revoke_record_s ...@@ -81,7 +81,7 @@ struct jbd2_revoke_record_s
{ {
struct list_head hash; struct list_head hash;
tid_t sequence; /* Used for recovery only */ 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); ...@@ -106,17 +106,18 @@ static void flush_descriptor(journal_t *, struct journal_head *, int);
/* Utility functions to maintain the revoke table */ /* Utility functions to maintain the revoke table */
/* Borrowed from buffer.c: this is a tried and tested block hash function */ /* 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; struct jbd2_revoke_table_s *table = journal->j_revoke;
int hash_shift = table->hash_shift; int hash_shift = table->hash_shift;
int hash = (int)block ^ (int)((block >> 31) >> 1);
return ((block << (hash_shift - 6)) ^ return ((hash << (hash_shift - 6)) ^
(block >> 13) ^ (hash >> 13) ^
(block << (hash_shift - 12))) & (table->hash_size - 1); (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) tid_t seq)
{ {
struct list_head *hash_list; struct list_head *hash_list;
...@@ -146,7 +147,7 @@ oom: ...@@ -146,7 +147,7 @@ oom:
/* Find a revoke record in the journal's hash table. */ /* Find a revoke record in the journal's hash table. */
static struct jbd2_revoke_record_s *find_revoke_record(journal_t *journal, static struct jbd2_revoke_record_s *find_revoke_record(journal_t *journal,
unsigned long blocknr) sector_t blocknr)
{ {
struct list_head *hash_list; struct list_head *hash_list;
struct jbd2_revoke_record_s *record; struct jbd2_revoke_record_s *record;
...@@ -325,7 +326,7 @@ void jbd2_journal_destroy_revoke(journal_t *journal) ...@@ -325,7 +326,7 @@ void jbd2_journal_destroy_revoke(journal_t *journal)
* by one. * 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_in)
{ {
struct buffer_head *bh = NULL; struct buffer_head *bh = NULL;
...@@ -394,7 +395,7 @@ int jbd2_journal_revoke(handle_t *handle, unsigned long blocknr, ...@@ -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, err = insert_revoke_hash(journal, blocknr,
handle->h_transaction->t_tid); handle->h_transaction->t_tid);
BUFFER_TRACE(bh_in, "exit"); BUFFER_TRACE(bh_in, "exit");
...@@ -649,7 +650,7 @@ static void flush_descriptor(journal_t *journal, ...@@ -649,7 +650,7 @@ static void flush_descriptor(journal_t *journal,
*/ */
int jbd2_journal_set_revoke(journal_t *journal, int jbd2_journal_set_revoke(journal_t *journal,
unsigned long blocknr, sector_t blocknr,
tid_t sequence) tid_t sequence)
{ {
struct jbd2_revoke_record_s *record; struct jbd2_revoke_record_s *record;
...@@ -673,7 +674,7 @@ int jbd2_journal_set_revoke(journal_t *journal, ...@@ -673,7 +674,7 @@ int jbd2_journal_set_revoke(journal_t *journal,
*/ */
int jbd2_journal_test_revoke(journal_t *journal, int jbd2_journal_test_revoke(journal_t *journal,
unsigned long blocknr, sector_t blocknr,
tid_t sequence) tid_t sequence)
{ {
struct jbd2_revoke_record_s *record; struct jbd2_revoke_record_s *record;
......
...@@ -154,7 +154,7 @@ __ext4_journal_forget(const char *where, handle_t *handle, struct buffer_head *b ...@@ -154,7 +154,7 @@ __ext4_journal_forget(const char *where, handle_t *handle, struct buffer_head *b
static inline int static inline int
__ext4_journal_revoke(const char *where, handle_t *handle, __ext4_journal_revoke(const char *where, handle_t *handle,
unsigned long blocknr, struct buffer_head *bh) ext4_fsblk_t blocknr, struct buffer_head *bh)
{ {
int err = jbd2_journal_revoke(handle, blocknr, bh); int err = jbd2_journal_revoke(handle, blocknr, bh);
if (err) if (err)
......
...@@ -741,7 +741,7 @@ struct journal_s ...@@ -741,7 +741,7 @@ struct journal_s
*/ */
struct block_device *j_dev; struct block_device *j_dev;
int j_blocksize; int j_blocksize;
unsigned long j_blk_offset; sector_t j_blk_offset;
/* /*
* Device which holds the client fs. For internal journal this will be * Device which holds the client fs. For internal journal this will be
...@@ -860,7 +860,7 @@ extern void __journal_clean_data_list(transaction_t *transaction); ...@@ -860,7 +860,7 @@ extern void __journal_clean_data_list(transaction_t *transaction);
/* Log buffer allocation */ /* Log buffer allocation */
extern struct journal_head * jbd2_journal_get_descriptor_buffer(journal_t *); extern struct journal_head * jbd2_journal_get_descriptor_buffer(journal_t *);
int jbd2_journal_next_log_block(journal_t *, unsigned long *); int jbd2_journal_next_log_block(journal_t *, sector_t *);
/* Commit management */ /* Commit management */
extern void jbd2_journal_commit_transaction(journal_t *); extern void jbd2_journal_commit_transaction(journal_t *);
...@@ -875,7 +875,7 @@ extern int ...@@ -875,7 +875,7 @@ extern int
jbd2_journal_write_metadata_buffer(transaction_t *transaction, jbd2_journal_write_metadata_buffer(transaction_t *transaction,
struct journal_head *jh_in, struct journal_head *jh_in,
struct journal_head **jh_out, struct journal_head **jh_out,
unsigned long blocknr); sector_t blocknr);
/* Transaction locking */ /* Transaction locking */
extern void __wait_on_journal (journal_t *); extern void __wait_on_journal (journal_t *);
...@@ -923,7 +923,7 @@ extern void jbd2_journal_unlock_updates (journal_t *); ...@@ -923,7 +923,7 @@ extern void jbd2_journal_unlock_updates (journal_t *);
extern journal_t * jbd2_journal_init_dev(struct block_device *bdev, extern journal_t * jbd2_journal_init_dev(struct block_device *bdev,
struct block_device *fs_dev, struct block_device *fs_dev,
int start, int len, int bsize); sector_t start, int len, int bsize);
extern journal_t * jbd2_journal_init_inode (struct inode *); extern journal_t * jbd2_journal_init_inode (struct inode *);
extern int jbd2_journal_update_format (journal_t *); extern int jbd2_journal_update_format (journal_t *);
extern int jbd2_journal_check_used_features extern int jbd2_journal_check_used_features
...@@ -944,7 +944,7 @@ extern void jbd2_journal_abort (journal_t *, int); ...@@ -944,7 +944,7 @@ extern void jbd2_journal_abort (journal_t *, int);
extern int jbd2_journal_errno (journal_t *); extern int jbd2_journal_errno (journal_t *);
extern void jbd2_journal_ack_err (journal_t *); extern void jbd2_journal_ack_err (journal_t *);
extern int jbd2_journal_clear_err (journal_t *); extern int jbd2_journal_clear_err (journal_t *);
extern int jbd2_journal_bmap(journal_t *, unsigned long, unsigned long *); extern int jbd2_journal_bmap(journal_t *, unsigned long, sector_t *);
extern int jbd2_journal_force_commit(journal_t *); extern int jbd2_journal_force_commit(journal_t *);
/* /*
...@@ -977,14 +977,13 @@ extern void jbd2_journal_destroy_revoke_caches(void); ...@@ -977,14 +977,13 @@ extern void jbd2_journal_destroy_revoke_caches(void);
extern int jbd2_journal_init_revoke_caches(void); extern int jbd2_journal_init_revoke_caches(void);
extern void jbd2_journal_destroy_revoke(journal_t *); extern void jbd2_journal_destroy_revoke(journal_t *);
extern int jbd2_journal_revoke (handle_t *, extern int jbd2_journal_revoke (handle_t *, sector_t, struct buffer_head *);
unsigned long, struct buffer_head *);
extern int jbd2_journal_cancel_revoke(handle_t *, struct journal_head *); extern int jbd2_journal_cancel_revoke(handle_t *, struct journal_head *);
extern void jbd2_journal_write_revoke_records(journal_t *, transaction_t *); extern void jbd2_journal_write_revoke_records(journal_t *, transaction_t *);
/* Recovery revoke support */ /* Recovery revoke support */
extern int jbd2_journal_set_revoke(journal_t *, unsigned long, tid_t); extern int jbd2_journal_set_revoke(journal_t *, sector_t, tid_t);
extern int jbd2_journal_test_revoke(journal_t *, unsigned long, tid_t); extern int jbd2_journal_test_revoke(journal_t *, sector_t, tid_t);
extern void jbd2_journal_clear_revoke(journal_t *); extern void jbd2_journal_clear_revoke(journal_t *);
extern void jbd2_journal_switch_revoke_table(journal_t *journal); extern void jbd2_journal_switch_revoke_table(journal_t *journal);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment