diff options
| -rw-r--r-- | cli/src/cli.c | 6 | ||||
| -rw-r--r-- | glusterfsd/src/glusterfsd.c | 7 | ||||
| -rw-r--r-- | libglusterfs/src/call-stub.c | 14 | ||||
| -rw-r--r-- | libglusterfs/src/call-stub.h | 1 | ||||
| -rw-r--r-- | libglusterfs/src/glusterfs.h | 2 | 
5 files changed, 25 insertions, 5 deletions
diff --git a/cli/src/cli.c b/cli/src/cli.c index ad70696e258..127d6340f8d 100644 --- a/cli/src/cli.c +++ b/cli/src/cli.c @@ -71,7 +71,7 @@  #include "event.h"  #include "globals.h"  #include "syscall.h" - +#include "call-stub.h"  #include <fnmatch.h>  extern int connected; @@ -221,6 +221,10 @@ glusterfs_ctx_defaults_init (glusterfs_ctx_t *ctx)          if (!pool->stack_mem_pool)                  return -1; +        ctx->stub_mem_pool = mem_pool_new (call_stub_t, 1024); +        if (!ctx->stub_mem_pool) +                return -1; +          INIT_LIST_HEAD (&pool->all_frames);          LOCK_INIT (&pool->lock);          ctx->pool = pool; diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c index 24c45219b01..6daeac1293e 100644 --- a/glusterfsd/src/glusterfsd.c +++ b/glusterfsd/src/glusterfsd.c @@ -71,7 +71,7 @@  #include "latency.h"  #include "glusterfsd-mem-types.h"  #include "syscall.h" - +#include "call-stub.h"  #include <fnmatch.h>  #ifdef GF_DARWIN_HOST_OS @@ -594,6 +594,7 @@ cleanup_and_exit (int signum)          mem_pool_destroy (tmp_pool->frame_mem_pool);          mem_pool_destroy (tmp_pool->stack_mem_pool);          tmp_pool = NULL; +	 mem_pool_destroy (ctx->stub_mem_pool);          glusterfs_pidfile_cleanup (ctx); @@ -791,6 +792,10 @@ glusterfs_ctx_defaults_init (glusterfs_ctx_t *ctx)          if (!pool->stack_mem_pool)                  return -1; +        ctx->stub_mem_pool = mem_pool_new (call_stub_t, 1024); +        if (!ctx->stub_mem_pool) +                return -1; +          INIT_LIST_HEAD (&pool->all_frames);          LOCK_INIT (&pool->lock);          ctx->pool = pool; diff --git a/libglusterfs/src/call-stub.c b/libglusterfs/src/call-stub.c index 497637fa9dc..e505bf7fd3e 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 bc621ec83a5..a284ef929a7 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 8dc781d81ec..6f40b988024 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;  | 
