X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=fs%2Fjbd2%2Frevoke.c;h=9246e763da78f1491d53b9f0ae12d89579494eaf;hb=ecd27b92fbb41f779d857632a69bd45dbaf0f915;hp=2fccddc7acad0ebeb85236967d306565a6cc1b52;hpb=f7f4bccb729844a0fa873e224e3a6f7eeed095bb;p=linux-2.6 diff --git a/fs/jbd2/revoke.c b/fs/jbd2/revoke.c index 2fccddc7ac..9246e763da 100644 --- a/fs/jbd2/revoke.c +++ b/fs/jbd2/revoke.c @@ -1,5 +1,5 @@ /* - * linux/fs/revoke.c + * linux/fs/jbd2/revoke.c * * Written by Stephen C. Tweedie , 2000 * @@ -66,12 +66,11 @@ #include #include #include -#include #include #endif -static kmem_cache_t *jbd2_revoke_record_cache; -static kmem_cache_t *jbd2_revoke_table_cache; +static struct kmem_cache *jbd2_revoke_record_cache; +static struct kmem_cache *jbd2_revoke_table_cache; /* Each revoke record represents one single revoked block. During journal replay, this involves recording the transaction ID of the @@ -81,7 +80,7 @@ struct jbd2_revoke_record_s { struct list_head hash; tid_t sequence; /* Used for recovery only */ - unsigned long blocknr; + unsigned long long blocknr; }; @@ -106,17 +105,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, unsigned long long 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, unsigned long long blocknr, tid_t seq) { struct list_head *hash_list; @@ -146,7 +146,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) + unsigned long long blocknr) { struct list_head *hash_list; struct jbd2_revoke_record_s *record; @@ -168,13 +168,13 @@ static struct jbd2_revoke_record_s *find_revoke_record(journal_t *journal, int __init jbd2_journal_init_revoke_caches(void) { - jbd2_revoke_record_cache = kmem_cache_create("revoke_record", + jbd2_revoke_record_cache = kmem_cache_create("jbd2_revoke_record", sizeof(struct jbd2_revoke_record_s), 0, SLAB_HWCACHE_ALIGN, NULL, NULL); if (jbd2_revoke_record_cache == 0) return -ENOMEM; - jbd2_revoke_table_cache = kmem_cache_create("revoke_table", + jbd2_revoke_table_cache = kmem_cache_create("jbd2_revoke_table", sizeof(struct jbd2_revoke_table_s), 0, 0, NULL, NULL); if (jbd2_revoke_table_cache == 0) { @@ -325,7 +325,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, unsigned long long blocknr, struct buffer_head *bh_in) { struct buffer_head *bh = NULL; @@ -394,7 +394,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"); @@ -584,9 +584,17 @@ static void write_one_revoke_record(journal_t *journal, *descriptorp = descriptor; } - * ((__be32 *)(&jh2bh(descriptor)->b_data[offset])) = - cpu_to_be32(record->blocknr); - offset += 4; + if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_64BIT)) { + * ((__be64 *)(&jh2bh(descriptor)->b_data[offset])) = + cpu_to_be64(record->blocknr); + offset += 8; + + } else { + * ((__be32 *)(&jh2bh(descriptor)->b_data[offset])) = + cpu_to_be32(record->blocknr); + offset += 4; + } + *offsetp = offset; } @@ -641,7 +649,7 @@ static void flush_descriptor(journal_t *journal, */ int jbd2_journal_set_revoke(journal_t *journal, - unsigned long blocknr, + unsigned long long blocknr, tid_t sequence) { struct jbd2_revoke_record_s *record; @@ -665,7 +673,7 @@ int jbd2_journal_set_revoke(journal_t *journal, */ int jbd2_journal_test_revoke(journal_t *journal, - unsigned long blocknr, + unsigned long long blocknr, tid_t sequence) { struct jbd2_revoke_record_s *record;