[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>
diff --git a/fs/jbd2/revoke.c b/fs/jbd2/revoke.c
index 8aac875..3310a1d 100644
--- a/fs/jbd2/revoke.c
+++ b/fs/jbd2/revoke.c
@@ -81,7 +81,7 @@
{
struct list_head hash;
tid_t sequence; /* Used for recovery only */
- unsigned long blocknr;
+ sector_t blocknr;
};
@@ -106,17 +106,18 @@
/* 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 @@
/* 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 @@
* 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 @@
}
}
- 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 @@
*/
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_test_revoke(journal_t *journal,
- unsigned long blocknr,
+ sector_t blocknr,
tid_t sequence)
{
struct jbd2_revoke_record_s *record;