diff options
Diffstat (limited to 'libglusterfs/src')
-rw-r--r-- | libglusterfs/src/fd.c | 8 | ||||
-rw-r--r-- | libglusterfs/src/inode.c | 7 | ||||
-rw-r--r-- | libglusterfs/src/inode.h | 1 |
3 files changed, 14 insertions, 2 deletions
diff --git a/libglusterfs/src/fd.c b/libglusterfs/src/fd.c index 9269e5cf8..231b7c5b0 100644 --- a/libglusterfs/src/fd.c +++ b/libglusterfs/src/fd.c @@ -402,6 +402,7 @@ fd_destroy (fd_t *fd) xlator_t *xl = NULL; int i = 0; xlator_t *old_THIS = NULL; + struct mem_pool *tmp_pool = NULL; if (fd == NULL){ gf_log ("xlator", GF_LOG_ERROR, "invalid arugument"); @@ -415,6 +416,8 @@ fd_destroy (fd_t *fd) if (!fd->_ctx) goto out; + tmp_pool = fd->inode->table->fd_mem_pool; + if (IA_ISDIR (fd->inode->ia_type)) { for (i = 0; i < fd->inode->table->xl->graph->xl_count; i++) { if (fd->_ctx[i].key) { @@ -444,7 +447,8 @@ fd_destroy (fd_t *fd) GF_FREE (fd->_ctx); inode_unref (fd->inode); fd->inode = (inode_t *)0xaaaaaaaa; - GF_FREE (fd); + mem_put (tmp_pool,fd); + tmp_pool = NULL; out: return; } @@ -505,7 +509,7 @@ fd_create (inode_t *inode, pid_t pid) return NULL; } - fd = GF_CALLOC (1, sizeof (fd_t), gf_common_mt_fd_t); + fd = mem_get (inode->table->fd_mem_pool); if (!fd) goto out; diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c index 5d35d4cc3..ad65081dc 100644 --- a/libglusterfs/src/inode.c +++ b/libglusterfs/src/inode.c @@ -1098,6 +1098,13 @@ inode_table_new (size_t lru_limit, xlator_t *xl) return NULL; } + new->fd_mem_pool = mem_pool_new (fd_t, 16384); + + if (!new->fd_mem_pool) { + GF_FREE (new->inode_hash); + GF_FREE (new); + } + for (i=0; i<new->hashsize; i++) { INIT_LIST_HEAD (&new->inode_hash[i]); } diff --git a/libglusterfs/src/inode.h b/libglusterfs/src/inode.h index dbc721546..18081b8f8 100644 --- a/libglusterfs/src/inode.h +++ b/libglusterfs/src/inode.h @@ -65,6 +65,7 @@ struct _inode_table { uint32_t attic_size; struct mem_pool *inode_pool; /* memory pool for inodes */ struct mem_pool *dentry_pool; /* memory pool for dentrys */ + struct mem_pool *fd_mem_pool; /* memory pool for fd_t */ }; |