The current algorithm would choose a step size of 4 for
n_buckets == 31, but 1 for n_buckets == 32, which seems wrong.
Fix it.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/257
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
hash->n_buckets = n_buckets;
hash->free_value = free_value;
hash->step = n_buckets / 32;
- if (hash->step == 0)
+ if (hash->step < 4)
hash->step = 4;
else if (hash->step > 64)
hash->step = 64;