summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorshishir gowda <shishirng@gluster.com>2010-08-05 04:00:59 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-08-06 03:37:40 -0700
commite85069767b28fe12cf3dcc4ccf1a5cfc10753c4b (patch)
treea95b091bc59496463086baafcf48b0c14ec3ae07 /libglusterfs
parentf9431f330e8f304e82d9b1443018987a926d56b6 (diff)
mem pool for call_stub_t
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 'libglusterfs')
-rw-r--r--libglusterfs/src/call-stub.c14
-rw-r--r--libglusterfs/src/call-stub.h1
-rw-r--r--libglusterfs/src/glusterfs.h2
3 files changed, 14 insertions, 3 deletions
diff --git a/libglusterfs/src/call-stub.c b/libglusterfs/src/call-stub.c
index 497637fa9..e505bf7fd 100644
--- a/libglusterfs/src/call-stub.c
+++ b/libglusterfs/src/call-stub.c
@@ -38,13 +38,14 @@ stub_new (call_frame_t *frame,
GF_VALIDATE_OR_GOTO ("call-stub", frame, out);
- new = GF_CALLOC (1, sizeof (*new), gf_common_mt_call_stub_t);
+ new = mem_get (frame->this->ctx->stub_mem_pool);
+ memset (new, 0, sizeof (call_stub_t));
GF_VALIDATE_OR_GOTO ("call-stub", new, out);
new->frame = frame;
new->wind = wind;
new->fop = fop;
-
+ new->stub_mem_pool = frame->this->ctx->stub_mem_pool;
INIT_LIST_HEAD (&new->list);
out:
return new;
@@ -3824,7 +3825,11 @@ call_stub_destroy_unwind (call_stub_t *stub)
void
call_stub_destroy (call_stub_t *stub)
{
+ struct mem_pool *tmp_pool = NULL;
+
GF_VALIDATE_OR_GOTO ("call-stub", stub, out);
+
+ tmp_pool = stub->stub_mem_pool;
if (stub->wind) {
call_stub_destroy_wind (stub);
@@ -3832,8 +3837,11 @@ call_stub_destroy (call_stub_t *stub)
call_stub_destroy_unwind (stub);
}
- GF_FREE (stub);
+ stub->stub_mem_pool = NULL;
+ mem_put (tmp_pool, stub);
out:
+ tmp_pool = NULL;
+
return;
}
diff --git a/libglusterfs/src/call-stub.h b/libglusterfs/src/call-stub.h
index bc621ec83..a284ef929 100644
--- a/libglusterfs/src/call-stub.h
+++ b/libglusterfs/src/call-stub.h
@@ -34,6 +34,7 @@ typedef struct {
char wind;
call_frame_t *frame;
glusterfs_fop_t fop;
+ struct mem_pool *stub_mem_pool; /* pointer to stub mempool in glusterfs ctx */
union {
/* lookup */
diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h
index 8dc781d81..6f40b9880 100644
--- a/libglusterfs/src/glusterfs.h
+++ b/libglusterfs/src/glusterfs.h
@@ -275,6 +275,8 @@ struct _glusterfs_ctx {
void *mgmt; /* xlator implementing MOPs for centralized logging, volfile server */
unsigned char measure_latency; /* toggle switch for latency measurement */
pthread_t sigwaiter;
+ struct mem_pool *stub_mem_pool;
+
};
typedef struct _glusterfs_ctx glusterfs_ctx_t;