KVM: SVM: force a new asid when initializing the vmcb
[safe/jmp/linux-2.6] / fs / jbd2 / revoke.c
index 3310a1d..2e1453a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * linux/fs/revoke.c
+ * linux/fs/jbd2/revoke.c
  *
  * Written by Stephen C. Tweedie <sct@redhat.com>, 2000
  *
 #include <linux/errno.h>
 #include <linux/slab.h>
 #include <linux/list.h>
-#include <linux/smp_lock.h>
 #include <linux/init.h>
 #endif
+#include <linux/log2.h>
 
-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 +81,7 @@ struct jbd2_revoke_record_s
 {
        struct list_head  hash;
        tid_t             sequence;     /* Used for recovery only */
-       sector_t          blocknr;
+       unsigned long long        blocknr;
 };
 
 
@@ -106,7 +106,7 @@ 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, sector_t 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;
@@ -117,7 +117,7 @@ static inline int hash(journal_t *journal, sector_t block)
                (hash << (hash_shift - 12))) & (table->hash_size - 1);
 }
 
-static int insert_revoke_hash(journal_t *journal, sector_t blocknr,
+static int insert_revoke_hash(journal_t *journal, unsigned long long blocknr,
                              tid_t seq)
 {
        struct list_head *hash_list;
@@ -147,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,
-                                                     sector_t blocknr)
+                                                     unsigned long long blocknr)
 {
        struct list_head *hash_list;
        struct jbd2_revoke_record_s *record;
@@ -171,14 +171,16 @@ int __init jbd2_journal_init_revoke_caches(void)
 {
        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)
+                                          0,
+                                          SLAB_HWCACHE_ALIGN|SLAB_TEMPORARY,
+                                          NULL);
+       if (!jbd2_revoke_record_cache)
                return -ENOMEM;
 
        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) {
+                                          0, SLAB_TEMPORARY, NULL);
+       if (!jbd2_revoke_table_cache) {
                kmem_cache_destroy(jbd2_revoke_record_cache);
                jbd2_revoke_record_cache = NULL;
                return -ENOMEM;
@@ -213,7 +215,7 @@ int jbd2_journal_init_revoke(journal_t *journal, int hash_size)
        journal->j_revoke = journal->j_revoke_table[0];
 
        /* Check that the hash_size is a power of two */
-       J_ASSERT ((hash_size & (hash_size-1)) == 0);
+       J_ASSERT(is_power_of_2(hash_size));
 
        journal->j_revoke->hash_size = hash_size;
 
@@ -240,7 +242,7 @@ int jbd2_journal_init_revoke(journal_t *journal, int hash_size)
        journal->j_revoke = journal->j_revoke_table[1];
 
        /* Check that the hash_size is a power of two */
-       J_ASSERT ((hash_size & (hash_size-1)) == 0);
+       J_ASSERT(is_power_of_2(hash_size));
 
        journal->j_revoke->hash_size = hash_size;
 
@@ -326,7 +328,7 @@ void jbd2_journal_destroy_revoke(journal_t *journal)
  * by one.
  */
 
-int jbd2_journal_revoke(handle_t *handle, sector_t blocknr,
+int jbd2_journal_revoke(handle_t *handle, unsigned long long blocknr,
                   struct buffer_head *bh_in)
 {
        struct buffer_head *bh = NULL;
@@ -352,7 +354,7 @@ int jbd2_journal_revoke(handle_t *handle, sector_t blocknr,
                if (bh)
                        BUFFER_TRACE(bh, "found on hash");
        }
-#ifdef JBD_EXPENSIVE_CHECKING
+#ifdef JBD2_EXPENSIVE_CHECKING
        else {
                struct buffer_head *bh2;
 
@@ -453,7 +455,7 @@ int jbd2_journal_cancel_revoke(handle_t *handle, struct journal_head *jh)
                }
        }
 
-#ifdef JBD_EXPENSIVE_CHECKING
+#ifdef JBD2_EXPENSIVE_CHECKING
        /* There better not be one left behind by now! */
        record = find_revoke_record(journal, bh->b_blocknr);
        J_ASSERT_JH(jh, record == NULL);
@@ -650,7 +652,7 @@ static void flush_descriptor(journal_t *journal,
  */
 
 int jbd2_journal_set_revoke(journal_t *journal,
-                      sector_t blocknr,
+                      unsigned long long blocknr,
                       tid_t sequence)
 {
        struct jbd2_revoke_record_s *record;
@@ -674,7 +676,7 @@ int jbd2_journal_set_revoke(journal_t *journal,
  */
 
 int jbd2_journal_test_revoke(journal_t *journal,
-                       sector_t blocknr,
+                       unsigned long long blocknr,
                        tid_t sequence)
 {
        struct jbd2_revoke_record_s *record;