From f9431f330e8f304e82d9b1443018987a926d56b6 Mon Sep 17 00:00:00 2001 From: shishir gowda Date: Thu, 5 Aug 2010 04:00:14 +0000 Subject: mem pool for fd_t Ran posix compliance test and sanity test Signed-off-by: shishir gowda Signed-off-by: Anand V. Avati BUG: 329 (Replacing memory allocation functions with mem-type functions) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=329 --- libglusterfs/src/fd.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'libglusterfs/src/fd.c') 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; -- cgit