On 03/22/15 at 12:17pm, Thomas Graf wrote:
On 03/22/15 at 07:04pm, Herbert Xu wrote:
quoted
+ struct bucket_table *new_tbl;
+ struct bucket_table *tbl;
+ int err;
- ASSERT_RHT_MUTEX(ht);
+ if (size < ht->p.min_size)
+ size = ht->p.min_size;
We should only shrink if size < old_tbl->size
I found the check further down. Any particular reason why check
after allocation and then free again? Why do you want to avoid
the allocation inside the mutex?
quoted
- new_tbl = bucket_table_alloc(ht, old_tbl->size / 2);
+ new_tbl = bucket_table_alloc(ht, size);
if (new_tbl == NULL)
return -ENOMEM;