diff options
| author | Herbert Xu <herbert@gondor.apana.org.au> | 2015-03-13 22:57:24 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2015-03-15 01:35:34 -0400 |
| commit | 63d512d0cffcae40505d9448abd509972465e846 (patch) | |
| tree | 61aa0d3763daf884a089e41f8f0f7b829b9357c4 /include/linux | |
| parent | 9d901bc05153bbf33b5da2cd6266865e531f0545 (diff) | |
rhashtable: Add rehash counter to bucket_table
This patch adds a rehash counter to bucket_table to indicate
the last bucket that has been rehashed. This serves two purposes:
1. Any bucket that has been rehashed can never gain a new object.
2. If the rehash counter reaches the size of the table, the table
will forever remain empty.
This patch also downsizes bucket_table->size to an unsigned int
since we do not support sizes greater than 32 bits yet.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/rhashtable.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h index a0abddd226b3..ed7562ad4ca0 100644 --- a/include/linux/rhashtable.h +++ b/include/linux/rhashtable.h | |||
| @@ -49,6 +49,7 @@ struct rhash_head { | |||
| 49 | /** | 49 | /** |
| 50 | * struct bucket_table - Table of hash buckets | 50 | * struct bucket_table - Table of hash buckets |
| 51 | * @size: Number of hash buckets | 51 | * @size: Number of hash buckets |
| 52 | * @rehash: Current bucket being rehashed | ||
| 52 | * @hash_rnd: Random seed to fold into hash | 53 | * @hash_rnd: Random seed to fold into hash |
| 53 | * @shift: Current size (1 << shift) | 54 | * @shift: Current size (1 << shift) |
| 54 | * @locks_mask: Mask to apply before accessing locks[] | 55 | * @locks_mask: Mask to apply before accessing locks[] |
| @@ -58,7 +59,8 @@ struct rhash_head { | |||
| 58 | * @buckets: size * hash buckets | 59 | * @buckets: size * hash buckets |
| 59 | */ | 60 | */ |
| 60 | struct bucket_table { | 61 | struct bucket_table { |
| 61 | size_t size; | 62 | unsigned int size; |
| 63 | unsigned int rehash; | ||
| 62 | u32 hash_rnd; | 64 | u32 hash_rnd; |
| 63 | u32 shift; | 65 | u32 shift; |
| 64 | unsigned int locks_mask; | 66 | unsigned int locks_mask; |
