summaryrefslogtreecommitdiffstats
path: root/glusterfsd
diff options
context:
space:
mode:
authorshishir gowda <shishirng@gluster.com>2010-08-05 03:58:37 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-08-06 03:37:28 -0700
commit305025fbf823007fe715ea1ae0bbe44102221663 (patch)
treeaa26fd6304b5a2a95ef54a905a842a6e83436b22 /glusterfsd
parentd8a94293b142f963ad255e4fe9c2d1fafe3caeb6 (diff)
Implement mem pool for frame and stack
Ran posix compliance test and sanity test Signed-off-by: shishir gowda <shishirng@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 329 (Replacing memory allocation functions with mem-type functions) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=329
Diffstat (limited to 'glusterfsd')
-rw-r--r--glusterfsd/src/glusterfsd.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c
index 7fd4478800f..24c45219b01 100644
--- a/glusterfsd/src/glusterfsd.c
+++ b/glusterfsd/src/glusterfsd.c
@@ -584,11 +584,17 @@ static void
cleanup_and_exit (int signum)
{
glusterfs_ctx_t *ctx = NULL;
+ call_pool_t *tmp_pool = NULL;
ctx = glusterfs_ctx_get ();
gf_log ("glusterfsd", GF_LOG_NORMAL, "shutting down");
+ tmp_pool = ctx->pool;
+ mem_pool_destroy (tmp_pool->frame_mem_pool);
+ mem_pool_destroy (tmp_pool->stack_mem_pool);
+ tmp_pool = NULL;
+
glusterfs_pidfile_cleanup (ctx);
exit (0);
@@ -772,6 +778,19 @@ glusterfs_ctx_defaults_init (glusterfs_ctx_t *ctx)
gfd_mt_call_pool_t);
if (!pool)
return -1;
+
+ /* frame_mem_pool size 112 * 16k */
+ pool->frame_mem_pool = mem_pool_new (call_frame_t, 16384);
+
+ if (!pool->frame_mem_pool)
+ return -1;
+
+ /* stack_mem_pool size 256 * 8k */
+ pool->stack_mem_pool = mem_pool_new (call_stack_t, 8192);
+
+ if (!pool->stack_mem_pool)
+ return -1;
+
INIT_LIST_HEAD (&pool->all_frames);
LOCK_INIT (&pool->lock);
ctx->pool = pool;