]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - fs/jbd/revoke.c
fs/jbd/revoke.c: replace shift loop by ilog2
[karo-tx-linux.git] / fs / jbd / revoke.c
index 25c713e7071c75617dbda7dcf941efadf9eff30b..8898bbd2b61ee477b4f5168e9840c3a6d9048198 100644 (file)
@@ -231,19 +231,15 @@ record_cache_failure:
 
 static struct jbd_revoke_table_s *journal_init_revoke_table(int hash_size)
 {
-       int shift = 0;
-       int tmp = hash_size;
+       int i;
        struct jbd_revoke_table_s *table;
 
        table = kmem_cache_alloc(revoke_table_cache, GFP_KERNEL);
        if (!table)
                goto out;
 
-       while((tmp >>= 1UL) != 0UL)
-               shift++;
-
        table->hash_size = hash_size;
-       table->hash_shift = shift;
+       table->hash_shift = ilog2(hash_size);
        table->hash_table =
                kmalloc(hash_size * sizeof(struct list_head), GFP_KERNEL);
        if (!table->hash_table) {
@@ -252,8 +248,8 @@ static struct jbd_revoke_table_s *journal_init_revoke_table(int hash_size)
                goto out;
        }
 
-       for (tmp = 0; tmp < hash_size; tmp++)
-               INIT_LIST_HEAD(&table->hash_table[tmp]);
+       for (i = 0; i < hash_size; i++)
+               INIT_LIST_HEAD(&table->hash_table[i]);
 
 out:
        return table;