summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/rbthash.c5
-rw-r--r--libglusterfs/src/rbthash.h4
2 files changed, 5 insertions, 4 deletions
diff --git a/libglusterfs/src/rbthash.c b/libglusterfs/src/rbthash.c
index 829257448ea..c2cbf99b4a1 100644
--- a/libglusterfs/src/rbthash.c
+++ b/libglusterfs/src/rbthash.c
@@ -80,7 +80,8 @@ err:
rbthash_table_t *
-rbthash_table_init (int buckets, rbt_hasher_t hfunc, rbt_data_destroyer_t dfunc)
+rbthash_table_init (int buckets, rbt_hasher_t hfunc, rbt_data_destroyer_t dfunc,
+ unsigned long expected_entries)
{
rbthash_table_t *newtab = NULL;
int ret = -1;
@@ -100,7 +101,7 @@ rbthash_table_init (int buckets, rbt_hasher_t hfunc, rbt_data_destroyer_t dfunc)
goto free_newtab;
}
- newtab->entrypool = mem_pool_new (rbthash_entry_t, GF_RBTHASH_MEMPOOL);
+ newtab->entrypool = mem_pool_new (rbthash_entry_t, expected_entries);
if (!newtab->entrypool) {
gf_log (GF_RBTHASH, GF_LOG_ERROR,"Failed to allocate mem-pool");
goto free_buckets;
diff --git a/libglusterfs/src/rbthash.h b/libglusterfs/src/rbthash.h
index 5bfa6afd0ef..f2200f8957c 100644
--- a/libglusterfs/src/rbthash.h
+++ b/libglusterfs/src/rbthash.h
@@ -26,7 +26,7 @@
#include <pthread.h>
-#define GF_RBTHASH_MEMPOOL 1048576
+#define GF_RBTHASH_MEMPOOL 16384 //1048576
#define GF_RBTHASH "rbthash"
struct rbthash_bucket {
@@ -56,7 +56,7 @@ typedef struct rbthash_table {
extern rbthash_table_t *
rbthash_table_init (int buckets, rbt_hasher_t hfunc,
- rbt_data_destroyer_t dfunc);
+ rbt_data_destroyer_t dfunc, unsigned long expected_entries);
extern int
rbthash_insert (rbthash_table_t *tbl, void *data, void *key, int keylen);