]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - include/linux/rhashtable.h
rhashtable: Use 'unsigned int' consistently
[karo-tx-linux.git] / include / linux / rhashtable.h
index f9ecf32bce55e8b3216cdd50286e1aca004e5e98..f89cda067cb97b51aa46f08c170b2dc7f2dc5b3c 100644 (file)
@@ -133,6 +133,7 @@ struct rhashtable_params {
  * @p: Configuration parameters
  * @run_work: Deferred worker to expand/shrink asynchronously
  * @mutex: Mutex to protect current/future table swapping
+ * @lock: Spin lock to protect walker list
  * @being_destroyed: True if table is set up for destruction
  */
 struct rhashtable {
@@ -144,6 +145,7 @@ struct rhashtable {
        struct rhashtable_params        p;
        struct work_struct              run_work;
        struct mutex                    mutex;
+       spinlock_t                      lock;
 };
 
 /**
@@ -206,13 +208,13 @@ static inline unsigned int rht_key_hashfn(
        struct rhashtable *ht, const struct bucket_table *tbl,
        const void *key, const struct rhashtable_params params)
 {
-       unsigned hash;
+       unsigned int hash;
 
        /* params must be equal to ht->p if it isn't constant. */
        if (!__builtin_constant_p(params.key_len))
                hash = ht->p.hashfn(key, ht->key_len, tbl->hash_rnd);
        else if (params.key_len) {
-               unsigned key_len = params.key_len;
+               unsigned int key_len = params.key_len;
 
                if (params.hashfn)
                        hash = params.hashfn(key, key_len, tbl->hash_rnd);
@@ -222,7 +224,7 @@ static inline unsigned int rht_key_hashfn(
                        hash = jhash2(key, key_len / sizeof(u32),
                                      tbl->hash_rnd);
        } else {
-               unsigned key_len = ht->p.key_len;
+               unsigned int key_len = ht->p.key_len;
 
                if (params.hashfn)
                        hash = params.hashfn(key, key_len, tbl->hash_rnd);
@@ -510,7 +512,7 @@ static inline void *rhashtable_lookup_fast(
        };
        const struct bucket_table *tbl;
        struct rhash_head *he;
-       unsigned hash;
+       unsigned int hash;
 
        rcu_read_lock();
 
@@ -548,8 +550,8 @@ static inline int __rhashtable_insert_fast(
        struct bucket_table *tbl, *new_tbl;
        struct rhash_head *head;
        spinlock_t *lock;
-       unsigned elasticity;
-       unsigned hash;
+       unsigned int elasticity;
+       unsigned int hash;
        int err;
 
 restart:
@@ -583,8 +585,8 @@ restart:
        if (unlikely(rht_grow_above_100(ht, tbl))) {
 slow_path:
                spin_unlock_bh(lock);
-               rcu_read_unlock();
                err = rhashtable_insert_rehash(ht);
+               rcu_read_unlock();
                if (err)
                        return err;
 
@@ -716,7 +718,7 @@ static inline int __rhashtable_remove_fast(
        struct rhash_head __rcu **pprev;
        struct rhash_head *he;
        spinlock_t * lock;
-       unsigned hash;
+       unsigned int hash;
        int err = -ENOENT;
 
        hash = rht_head_hashfn(ht, tbl, obj, params);