|
@@ -28,25 +28,8 @@
|
|
|
#include <linux/rhashtable-types.h>
|
|
|
/*
|
|
|
* The end of the chain is marked with a special nulls marks which has
|
|
|
- * the following format:
|
|
|
- *
|
|
|
- * +-------+-----------------------------------------------------+-+
|
|
|
- * | Base | Hash |1|
|
|
|
- * +-------+-----------------------------------------------------+-+
|
|
|
- *
|
|
|
- * Base (4 bits) : Reserved to distinguish between multiple tables.
|
|
|
- * Specified via &struct rhashtable_params.nulls_base.
|
|
|
- * Hash (27 bits): Full hash (unmasked) of first element added to bucket
|
|
|
- * 1 (1 bit) : Nulls marker (always set)
|
|
|
- *
|
|
|
- * The remaining bits of the next pointer remain unused for now.
|
|
|
+ * the least significant bit set.
|
|
|
*/
|
|
|
-#define RHT_BASE_BITS 4
|
|
|
-#define RHT_HASH_BITS 27
|
|
|
-#define RHT_BASE_SHIFT RHT_HASH_BITS
|
|
|
-
|
|
|
-/* Base bits plus 1 bit for nulls marker */
|
|
|
-#define RHT_HASH_RESERVED_SPACE (RHT_BASE_BITS + 1)
|
|
|
|
|
|
/* Maximum chain length before rehash
|
|
|
*
|
|
@@ -92,24 +75,14 @@ struct bucket_table {
|
|
|
struct rhash_head __rcu *buckets[] ____cacheline_aligned_in_smp;
|
|
|
};
|
|
|
|
|
|
-static inline unsigned long rht_marker(const struct rhashtable *ht, u32 hash)
|
|
|
-{
|
|
|
- return NULLS_MARKER(ht->p.nulls_base + hash);
|
|
|
-}
|
|
|
-
|
|
|
#define INIT_RHT_NULLS_HEAD(ptr, ht, hash) \
|
|
|
- ((ptr) = (typeof(ptr)) rht_marker(ht, hash))
|
|
|
+ ((ptr) = (typeof(ptr)) NULLS_MARKER(0))
|
|
|
|
|
|
static inline bool rht_is_a_nulls(const struct rhash_head *ptr)
|
|
|
{
|
|
|
return ((unsigned long) ptr & 1);
|
|
|
}
|
|
|
|
|
|
-static inline unsigned long rht_get_nulls_value(const struct rhash_head *ptr)
|
|
|
-{
|
|
|
- return ((unsigned long) ptr) >> 1;
|
|
|
-}
|
|
|
-
|
|
|
static inline void *rht_obj(const struct rhashtable *ht,
|
|
|
const struct rhash_head *he)
|
|
|
{
|
|
@@ -119,7 +92,7 @@ static inline void *rht_obj(const struct rhashtable *ht,
|
|
|
static inline unsigned int rht_bucket_index(const struct bucket_table *tbl,
|
|
|
unsigned int hash)
|
|
|
{
|
|
|
- return (hash >> RHT_HASH_RESERVED_SPACE) & (tbl->size - 1);
|
|
|
+ return hash & (tbl->size - 1);
|
|
|
}
|
|
|
|
|
|
static inline unsigned int rht_key_get_hash(struct rhashtable *ht,
|