aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jbd2/revoke.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/jbd2/revoke.c')
-rw-r--r--fs/jbd2/revoke.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/fs/jbd2/revoke.c b/fs/jbd2/revoke.c
index 8aac875bd301..3310a1d7ace9 100644
--- a/fs/jbd2/revoke.c
+++ b/fs/jbd2/revoke.c
@@ -81,7 +81,7 @@ struct jbd2_revoke_record_s
81{ 81{
82 struct list_head hash; 82 struct list_head hash;
83 tid_t sequence; /* Used for recovery only */ 83 tid_t sequence; /* Used for recovery only */
84 unsigned long blocknr; 84 sector_t blocknr;
85}; 85};
86 86
87 87
@@ -106,17 +106,18 @@ static void flush_descriptor(journal_t *, struct journal_head *, int);
106/* Utility functions to maintain the revoke table */ 106/* Utility functions to maintain the revoke table */
107 107
108/* Borrowed from buffer.c: this is a tried and tested block hash function */ 108/* Borrowed from buffer.c: this is a tried and tested block hash function */
109static inline int hash(journal_t *journal, unsigned long block) 109static inline int hash(journal_t *journal, sector_t block)
110{ 110{
111 struct jbd2_revoke_table_s *table = journal->j_revoke; 111 struct jbd2_revoke_table_s *table = journal->j_revoke;
112 int hash_shift = table->hash_shift; 112 int hash_shift = table->hash_shift;
113 int hash = (int)block ^ (int)((block >> 31) >> 1);
113 114
114 return ((block << (hash_shift - 6)) ^ 115 return ((hash << (hash_shift - 6)) ^
115 (block >> 13) ^ 116 (hash >> 13) ^
116 (block << (hash_shift - 12))) & (table->hash_size - 1); 117 (hash << (hash_shift - 12))) & (table->hash_size - 1);
117} 118}
118 119
119static int insert_revoke_hash(journal_t *journal, unsigned long blocknr, 120static int insert_revoke_hash(journal_t *journal, sector_t blocknr,
120 tid_t seq) 121 tid_t seq)
121{ 122{
122 struct list_head *hash_list; 123 struct list_head *hash_list;
@@ -146,7 +147,7 @@ oom:
146/* Find a revoke record in the journal's hash table. */ 147/* Find a revoke record in the journal's hash table. */
147 148
148static struct jbd2_revoke_record_s *find_revoke_record(journal_t *journal, 149static struct jbd2_revoke_record_s *find_revoke_record(journal_t *journal,
149 unsigned long blocknr) 150 sector_t blocknr)
150{ 151{
151 struct list_head *hash_list; 152 struct list_head *hash_list;
152 struct jbd2_revoke_record_s *record; 153 struct jbd2_revoke_record_s *record;
@@ -325,7 +326,7 @@ void jbd2_journal_destroy_revoke(journal_t *journal)
325 * by one. 326 * by one.
326 */ 327 */
327 328
328int jbd2_journal_revoke(handle_t *handle, unsigned long blocknr, 329int jbd2_journal_revoke(handle_t *handle, sector_t blocknr,
329 struct buffer_head *bh_in) 330 struct buffer_head *bh_in)
330{ 331{
331 struct buffer_head *bh = NULL; 332 struct buffer_head *bh = NULL;
@@ -394,7 +395,7 @@ int jbd2_journal_revoke(handle_t *handle, unsigned long blocknr,
394 } 395 }
395 } 396 }
396 397
397 jbd_debug(2, "insert revoke for block %lu, bh_in=%p\n", blocknr, bh_in); 398 jbd_debug(2, "insert revoke for block %llu, bh_in=%p\n",blocknr, bh_in);
398 err = insert_revoke_hash(journal, blocknr, 399 err = insert_revoke_hash(journal, blocknr,
399 handle->h_transaction->t_tid); 400 handle->h_transaction->t_tid);
400 BUFFER_TRACE(bh_in, "exit"); 401 BUFFER_TRACE(bh_in, "exit");
@@ -649,7 +650,7 @@ static void flush_descriptor(journal_t *journal,
649 */ 650 */
650 651
651int jbd2_journal_set_revoke(journal_t *journal, 652int jbd2_journal_set_revoke(journal_t *journal,
652 unsigned long blocknr, 653 sector_t blocknr,
653 tid_t sequence) 654 tid_t sequence)
654{ 655{
655 struct jbd2_revoke_record_s *record; 656 struct jbd2_revoke_record_s *record;
@@ -673,7 +674,7 @@ int jbd2_journal_set_revoke(journal_t *journal,
673 */ 674 */
674 675
675int jbd2_journal_test_revoke(journal_t *journal, 676int jbd2_journal_test_revoke(journal_t *journal,
676 unsigned long blocknr, 677 sector_t blocknr,
677 tid_t sequence) 678 tid_t sequence)
678{ 679{
679 struct jbd2_revoke_record_s *record; 680 struct jbd2_revoke_record_s *record;