summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2010-06-24 07:58:51 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-06-25 03:16:36 -0700
commit29893bcba579f7e37a6ace018ffda1c8abe45550 (patch)
tree88cd08652635723569fb4401485e07a0460b43a5
parentb8b2a9d2f49686d5056fb0ce6150cf9c54180b12 (diff)
added proper mem-types to GF_CALLOC in protocol
Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 875 (Implement a new protocol to provide proper backward/forward compatibility) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=875
-rw-r--r--libglusterfs/src/mem-types.h9
-rw-r--r--xlators/protocol/client/src/client-handshake.c3
-rw-r--r--xlators/protocol/client/src/client-mem-types.h1
-rw-r--r--xlators/protocol/client/src/client3_1-fops.c4
-rw-r--r--xlators/protocol/rpc/rpc-lib/src/rpc-clnt.c10
-rw-r--r--xlators/protocol/rpc/rpc-lib/src/rpc-transport.c13
-rw-r--r--xlators/protocol/rpc/rpc-lib/src/rpcsvc-auth.c2
-rw-r--r--xlators/protocol/rpc/rpc-lib/src/rpcsvc.c16
-rw-r--r--xlators/protocol/rpc/rpc-transport/socket/src/socket.c9
-rw-r--r--xlators/protocol/server/src/server-handshake.c18
-rw-r--r--xlators/protocol/server/src/server-helpers.c17
-rw-r--r--xlators/protocol/server/src/server-mem-types.h1
-rw-r--r--xlators/protocol/server/src/server.c31
-rw-r--r--xlators/protocol/server/src/server3_1-fops.c12
14 files changed, 79 insertions, 67 deletions
diff --git a/libglusterfs/src/mem-types.h b/libglusterfs/src/mem-types.h
index e8d4df5f1..18a8e8106 100644
--- a/libglusterfs/src/mem-types.h
+++ b/libglusterfs/src/mem-types.h
@@ -76,7 +76,16 @@ enum gf_common_mem_types_ {
gf_common_mt_rpcsvc_t,
gf_common_mt_rpcsvc_conn_t,
gf_common_mt_rpcsvc_program_t,
+ gf_common_mt_rpcsvc_listener_t,
+ gf_common_mt_rpcsvc_wrapper_t,
gf_common_mt_rpcsvc_stage_t,
+ gf_common_mt_rpcclnt_t,
+ gf_common_mt_rpcclnt_savedframe_t,
+ gf_common_mt_rpc_trans_t,
+ gf_common_mt_rpc_trans_pollin_t,
+ gf_common_mt_rpc_trans_handover_t,
+ gf_common_mt_rpc_trans_reqinfo_t,
+ gf_common_mt_rpc_trans_rsp_t,
gf_common_mt_glusterfs_graph_t,
gf_common_mt_end
};
diff --git a/xlators/protocol/client/src/client-handshake.c b/xlators/protocol/client/src/client-handshake.c
index 8d249d1b0..58d23779c 100644
--- a/xlators/protocol/client/src/client-handshake.c
+++ b/xlators/protocol/client/src/client-handshake.c
@@ -571,7 +571,8 @@ client_setvolume (xlator_t *this, struct rpc_clnt *rpc)
ret = -1;
goto fail;
}
- req.dict.dict_val = GF_CALLOC (1, req.dict.dict_len, 0);
+ req.dict.dict_val = GF_CALLOC (1, req.dict.dict_len,
+ gf_client_mt_clnt_req_buf_t);
ret = dict_serialize (options, req.dict.dict_val);
if (ret < 0) {
gf_log (this->name, GF_LOG_ERROR,
diff --git a/xlators/protocol/client/src/client-mem-types.h b/xlators/protocol/client/src/client-mem-types.h
index 5fadfafc9..638e537d1 100644
--- a/xlators/protocol/client/src/client-mem-types.h
+++ b/xlators/protocol/client/src/client-mem-types.h
@@ -26,6 +26,7 @@
enum gf_client_mem_types_ {
gf_client_mt_clnt_conf_t = gf_common_mt_end + 1,
gf_client_mt_clnt_local_t,
+ gf_client_mt_clnt_req_buf_t,
gf_client_mt_clnt_fdctx_t,
gf_client_mt_end,
};
diff --git a/xlators/protocol/client/src/client3_1-fops.c b/xlators/protocol/client/src/client3_1-fops.c
index 891aa019e..f91eebadd 100644
--- a/xlators/protocol/client/src/client3_1-fops.c
+++ b/xlators/protocol/client/src/client3_1-fops.c
@@ -2267,7 +2267,7 @@ protocol_client_reopendir (xlator_t *this, clnt_fd_ctx_t *fdctx)
goto out;
}
- local = GF_CALLOC (1, sizeof (*local), 0);
+ local = GF_CALLOC (1, sizeof (*local), gf_client_mt_clnt_local_t);
if (!local) {
goto out;
}
@@ -2340,7 +2340,7 @@ protocol_client_reopen (xlator_t *this, clnt_fd_ctx_t *fdctx)
goto out;
}
- local = GF_CALLOC (1, sizeof (*local), 0);
+ local = GF_CALLOC (1, sizeof (*local), gf_client_mt_clnt_local_t);
if (!local) {
goto out;
}
diff --git a/xlators/protocol/rpc/rpc-lib/src/rpc-clnt.c b/xlators/protocol/rpc/rpc-lib/src/rpc-clnt.c
index da02b9f42..84fdb9bb5 100644
--- a/xlators/protocol/rpc/rpc-lib/src/rpc-clnt.c
+++ b/xlators/protocol/rpc/rpc-lib/src/rpc-clnt.c
@@ -68,7 +68,8 @@ __saved_frames_put (struct saved_frames *frames, void *frame, int32_t procnum,
{
struct saved_frame *saved_frame = NULL;
- saved_frame = GF_CALLOC (sizeof (*saved_frame), 1, 0);
+ saved_frame = GF_CALLOC (1, sizeof (*saved_frame),
+ gf_common_mt_rpcclnt_savedframe_t);
if (!saved_frame) {
gf_log ("rpc-clnt", GF_LOG_ERROR, "out of memory");
goto out;
@@ -234,7 +235,8 @@ saved_frames_new (void)
{
struct saved_frames *saved_frames = NULL;
- saved_frames = GF_CALLOC (sizeof (*saved_frames), 1, 0);
+ saved_frames = GF_CALLOC (1, sizeof (*saved_frames),
+ gf_common_mt_rpcclnt_savedframe_t);
if (!saved_frames) {
gf_log ("rpc-clnt", GF_LOG_ERROR, "out of memory");
return NULL;
@@ -876,13 +878,14 @@ rpc_clnt_init (struct rpc_clnt_config *config, dict_t *options,
int ret = -1;
struct rpc_clnt *rpc = NULL;
- rpc = GF_CALLOC (1, sizeof (*rpc), 0);
+ rpc = GF_CALLOC (1, sizeof (*rpc), gf_common_mt_rpcclnt_t);
if (!rpc) {
gf_log ("rpc-clnt", GF_LOG_ERROR, "out of memory");
goto out;
}
pthread_mutex_init (&rpc->lock, NULL);
+ rpc->ctx = ctx;
ret = rpc_clnt_connection_init (rpc, ctx, options, name);
if (ret == -1) {
@@ -891,7 +894,6 @@ rpc_clnt_init (struct rpc_clnt_config *config, dict_t *options,
rpc = NULL;
goto out;
}
- rpc->ctx = ctx;
out:
return rpc;
}
diff --git a/xlators/protocol/rpc/rpc-lib/src/rpc-transport.c b/xlators/protocol/rpc/rpc-lib/src/rpc-transport.c
index 577158904..82ea9a74b 100644
--- a/xlators/protocol/rpc/rpc-lib/src/rpc-transport.c
+++ b/xlators/protocol/rpc/rpc-lib/src/rpc-transport.c
@@ -659,7 +659,7 @@ rpc_transport_pollin_alloc (rpc_transport_t *this, struct iobuf *iobuf,
size_t vectored_size, void *private)
{
rpc_transport_pollin_t *msg = NULL;
- msg = GF_CALLOC (1, sizeof (*msg), 0);
+ msg = GF_CALLOC (1, sizeof (*msg), gf_common_mt_rpc_trans_pollin_t);
if (!msg) {
gf_log ("rpc-transport", GF_LOG_ERROR, "out of memory");
goto out;
@@ -703,7 +703,7 @@ rpc_transport_same_process_pollin_alloc (rpc_transport_t *this,
goto err;
}
- msg = GF_CALLOC (1, sizeof (*msg), 0);
+ msg = GF_CALLOC (1, sizeof (*msg), gf_common_mt_rpc_trans_pollin_t);
if (!msg) {
gf_log ("rpc-transport", GF_LOG_ERROR, "out of memory");
goto err;
@@ -799,7 +799,7 @@ rpc_transport_handover_alloc (rpc_transport_pollin_t *pollin)
{
rpc_transport_handover_t *msg = NULL;
- msg = GF_CALLOC (1, sizeof (*msg), 0);
+ msg = GF_CALLOC (1, sizeof (*msg), gf_common_mt_rpc_trans_handover_t);
if (!msg) {
gf_log ("rpc_transport", GF_LOG_ERROR, "out of memory");
goto out;
@@ -846,7 +846,7 @@ rpc_transport_load (glusterfs_ctx_t *ctx, dict_t *options, char *trans_name)
GF_VALIDATE_OR_GOTO("rpc-transport", ctx, fail);
GF_VALIDATE_OR_GOTO("rpc-transport", trans_name, fail);
- trans = GF_CALLOC (1, sizeof (struct rpc_transport), 0);
+ trans = GF_CALLOC (1, sizeof (struct rpc_transport), gf_common_mt_rpc_trans_t);
GF_VALIDATE_OR_GOTO("rpc-transport", trans, fail);
trans->name = gf_strdup (trans_name);
@@ -949,7 +949,8 @@ rpc_transport_load (glusterfs_ctx_t *ctx, dict_t *options, char *trans_name)
goto fail;
}
- vol_opt = GF_CALLOC (1, sizeof (volume_opt_list_t), 0);
+ vol_opt = GF_CALLOC (1, sizeof (volume_opt_list_t),
+ gf_common_mt_volume_opt_list_t);
if (!vol_opt) {
gf_log (trans_name, GF_LOG_ERROR, "out of memory");
goto fail;
@@ -1017,7 +1018,7 @@ rpc_transport_submit_request (rpc_transport_t *this, rpc_transport_req_t *req)
if (this->peer_trans) {
peer_trans = this->peer_trans;
- rsp = GF_CALLOC (1, sizeof (*rsp), 0);
+ rsp = GF_CALLOC (1, sizeof (*rsp), gf_common_mt_rpc_trans_rsp_t);
if (!rsp) {
ret = -ENOMEM;
goto fail;
diff --git a/xlators/protocol/rpc/rpc-lib/src/rpcsvc-auth.c b/xlators/protocol/rpc/rpc-lib/src/rpcsvc-auth.c
index 50a55f5db..fa039c386 100644
--- a/xlators/protocol/rpc/rpc-lib/src/rpcsvc-auth.c
+++ b/xlators/protocol/rpc/rpc-lib/src/rpcsvc-auth.c
@@ -39,7 +39,7 @@ rpcsvc_auth_add_initer (struct list_head *list, char *idfier,
if ((!list) || (!init) || (!idfier))
return -1;
- new = GF_CALLOC (1, sizeof (*new), 0);
+ new = GF_CALLOC (1, sizeof (*new), gf_common_mt_rpcsvc_auth_list);
if (!new) {
gf_log (GF_RPCSVC, GF_LOG_ERROR, "Memory allocation failed");
return -1;
diff --git a/xlators/protocol/rpc/rpc-lib/src/rpcsvc.c b/xlators/protocol/rpc/rpc-lib/src/rpcsvc.c
index 1e0a05e45..e07cb8ee7 100644
--- a/xlators/protocol/rpc/rpc-lib/src/rpcsvc.c
+++ b/xlators/protocol/rpc/rpc-lib/src/rpcsvc.c
@@ -480,7 +480,7 @@ rpcsvc_conn_alloc (rpcsvc_t *svc, rpc_transport_t *trans)
int ret = -1;
unsigned int poolcount = 0;
- conn = GF_CALLOC (1, sizeof(*conn), 0);
+ conn = GF_CALLOC (1, sizeof(*conn), gf_common_mt_rpcsvc_conn_t);
if (!conn) {
gf_log (GF_RPCSVC, GF_LOG_ERROR, "memory allocation failed");
return NULL;
@@ -538,7 +538,7 @@ rpcsvc_notify_wrapper_alloc (void)
{
rpcsvc_notify_wrapper_t *wrapper = NULL;
- wrapper = GF_CALLOC (1, sizeof (*wrapper), 0);
+ wrapper = GF_CALLOC (1, sizeof (*wrapper), gf_common_mt_rpcsvc_wrapper_t);
if (!wrapper) {
gf_log (GF_RPCSVC, GF_LOG_ERROR, "memory allocation failed");
goto out;
@@ -609,7 +609,8 @@ rpcsvc_conn_destroy (rpcsvc_conn_t *conn)
pthread_mutex_lock (&svc->rpclock);
{
- wrappers = GF_CALLOC (svc->notify_count, sizeof (*wrapper), 0);
+ wrappers = GF_CALLOC (svc->notify_count, sizeof (*wrapper),
+ gf_common_mt_rpcsvc_wrapper_t);
if (!wrappers) {
goto unlock;
}
@@ -1181,6 +1182,8 @@ rpcsvc_handle_rpc_call (rpcsvc_conn_t *conn, rpc_transport_pollin_t *msg)
}
} else if (actor->actor) {
rpcsvc_conn_ref (req->conn);
+ /* Before going to xlator code, set the THIS properly */
+ THIS = conn->svc->mydata;
ret = actor->actor (req);
}
}
@@ -1761,7 +1764,8 @@ rpcsvc_listener_alloc (rpcsvc_t *svc, rpcsvc_conn_t *conn)
rpcsvc_listener_t *listener = NULL;
int ret = -1;
- listener = GF_CALLOC (1, sizeof (*listener), 0);
+ listener = GF_CALLOC (1, sizeof (*listener),
+ gf_common_mt_rpcsvc_listener_t);
if (!listener) {
gf_log (GF_RPCSVC, GF_LOG_ERROR, "memory allocation failed");
goto out;
@@ -1887,7 +1891,7 @@ rpcsvc_program_register (rpcsvc_t *svc, rpcsvc_program_t program)
if (!svc)
return -1;
- newprog = GF_CALLOC (1, sizeof(*newprog), 0);
+ newprog = GF_CALLOC (1, sizeof(*newprog), gf_common_mt_rpcsvc_program_t);
if (!newprog)
return -1;
@@ -1948,7 +1952,7 @@ rpcsvc_init (glusterfs_ctx_t *ctx, dict_t *options)
if ((!ctx) || (!options))
return NULL;
- svc = GF_CALLOC (1, sizeof (*svc), 0);
+ svc = GF_CALLOC (1, sizeof (*svc), gf_common_mt_rpcsvc_t);
if (!svc)
return NULL;
diff --git a/xlators/protocol/rpc/rpc-transport/socket/src/socket.c b/xlators/protocol/rpc/rpc-transport/socket/src/socket.c
index 5e56ff980..4ca7121e8 100644
--- a/xlators/protocol/rpc/rpc-transport/socket/src/socket.c
+++ b/xlators/protocol/rpc/rpc-transport/socket/src/socket.c
@@ -396,7 +396,7 @@ __socket_ioq_new (rpc_transport_t *this, rpc_transport_msg_t *msg)
priv = this->private;
/* TODO: use mem-pool */
- entry = GF_CALLOC (1, sizeof (*entry), 0);
+ entry = GF_CALLOC (1, sizeof (*entry), gf_common_mt_ioq);
if (!entry)
return NULL;
@@ -1054,7 +1054,7 @@ __socket_read_reply (rpc_transport_t *this)
buf = rpc_xid_addr (iobuf_ptr (priv->incoming.iobuf));
- request_info = GF_CALLOC (1, sizeof (*request_info), 0);
+ request_info = GF_CALLOC (1, sizeof (*request_info), gf_common_mt_rpc_trans_reqinfo_t);
if (request_info == NULL) {
gf_log (this->name, GF_LOG_ERROR, "out of memory");
goto out;
@@ -1501,7 +1501,8 @@ socket_server_event_handler (int fd, int idx, void *data,
}
}
- new_trans = GF_CALLOC (1, sizeof (*new_trans), 0);
+ new_trans = GF_CALLOC (1, sizeof (*new_trans),
+ gf_common_mt_rpc_trans_t);
new_trans->fini = this->fini;
new_trans->name = gf_strdup (this->name);
@@ -2152,7 +2153,7 @@ socket_init (rpc_transport_t *this)
return -1;
}
- priv = GF_CALLOC (1, sizeof (*priv), 0);
+ priv = GF_CALLOC (1, sizeof (*priv), gf_common_mt_socket_private_t);
if (!priv) {
gf_log (this->name, GF_LOG_ERROR,
"calloc (1, %"GF_PRI_SIZET") returned NULL",
diff --git a/xlators/protocol/server/src/server-handshake.c b/xlators/protocol/server/src/server-handshake.c
index 8ce9f6b3a..bc4d4afa2 100644
--- a/xlators/protocol/server/src/server-handshake.c
+++ b/xlators/protocol/server/src/server-handshake.c
@@ -537,11 +537,12 @@ server_setvolume (rpcsvc_request_t *req)
peerinfo = &req->conn->trans->peerinfo;
- ret = dict_set_static_ptr (params, "peer-info", peerinfo);
- if (ret < 0)
- gf_log (this->name, GF_LOG_DEBUG,
- "failed to set peer-info");
-
+ if (peerinfo) {
+ ret = dict_set_static_ptr (params, "peer-info", peerinfo);
+ if (ret < 0)
+ gf_log (this->name, GF_LOG_DEBUG,
+ "failed to set peer-info");
+ }
if (conf->auth_modules == NULL) {
gf_log (this->name, GF_LOG_ERROR,
"Authentication module not initialized");
@@ -553,7 +554,7 @@ server_setvolume (rpcsvc_request_t *req)
if (ret == AUTH_ACCEPT) {
gf_log (this->name, GF_LOG_INFO,
"accepted client from %s",
- peerinfo->identifier);
+ (peerinfo)?peerinfo->identifier:"");
op_ret = 0;
conn->bound_xl = xl;
ret = dict_set_str (reply, "ERROR", "Success");
@@ -563,7 +564,7 @@ server_setvolume (rpcsvc_request_t *req)
} else {
gf_log (this->name, GF_LOG_ERROR,
"Cannot authenticate client from %s",
- peerinfo->identifier);
+ (peerinfo)? peerinfo->identifier:"<>");
op_ret = -1;
op_errno = EACCES;
ret = dict_set_str (reply, "ERROR", "Authentication failed");
@@ -621,7 +622,8 @@ fail:
}
if (rsp.dict.dict_len) {
- rsp.dict.dict_val = GF_CALLOC (1, rsp.dict.dict_len, 0);
+ rsp.dict.dict_val = GF_CALLOC (1, rsp.dict.dict_len,
+ gf_server_mt_rsp_buf_t);
if (rsp.dict.dict_val) {
ret = dict_serialize (reply, rsp.dict.dict_val);
if (ret < 0) {
diff --git a/xlators/protocol/server/src/server-helpers.c b/xlators/protocol/server/src/server-helpers.c
index 44496a159..617a12a01 100644
--- a/xlators/protocol/server/src/server-helpers.c
+++ b/xlators/protocol/server/src/server-helpers.c
@@ -289,7 +289,7 @@ server_copy_frame (call_frame_t *frame)
new_frame = copy_frame (frame);
- new_state = GF_CALLOC (1, sizeof (server_state_t), 0);
+ new_state = GF_CALLOC (1, sizeof (server_state_t), gf_server_mt_state_t);
new_frame->root->op = frame->root->op;
new_frame->root->type = frame->root->type;
@@ -315,7 +315,7 @@ gf_add_locker (struct _lock_table *table, const char *volume,
struct _locker *new = NULL;
uint8_t dir = 0;
- new = GF_CALLOC (1, sizeof (struct _locker), 0);
+ new = GF_CALLOC (1, sizeof (struct _locker), gf_server_mt_locker_t);
if (new == NULL) {
gf_log ("server", GF_LOG_ERROR,
"failed to allocate memory for \'struct _locker\'");
@@ -455,7 +455,7 @@ gf_lock_table_new (void)
{
struct _lock_table *new = NULL;
- new = GF_CALLOC (1, sizeof (struct _lock_table), 0);
+ new = GF_CALLOC (1, sizeof (struct _lock_table), gf_server_mt_lock_table_t);
if (new == NULL) {
gf_log ("server-protocol", GF_LOG_CRITICAL,
"failed to allocate memory for new lock table");
@@ -893,7 +893,8 @@ server_connection_get (xlator_t *this, const char *id)
}
if (!conn) {
- conn = (void *) GF_CALLOC (1, sizeof (*conn), 0);
+ conn = (void *) GF_CALLOC (1, sizeof (*conn),
+ gf_server_mt_conn_t);
conn->id = gf_strdup (id);
conn->fdtable = gf_fd_fdtable_alloc ();
@@ -959,7 +960,7 @@ server_alloc_frame (rpcsvc_request_t *req)
frame = create_frame (conn->this, req->conn->svc->ctx->pool);
GF_VALIDATE_OR_GOTO("server", frame, out);
- state = GF_CALLOC (1, sizeof (*state), 0);
+ state = GF_CALLOC (1, sizeof (*state), gf_server_mt_state_t);
GF_VALIDATE_OR_GOTO("server", state, out);
if (conn->bound_xl)
@@ -1091,7 +1092,7 @@ create_server_conn_state (xlator_t *this, rpc_transport_t *xprt)
server_connection_t *conn = NULL;
int ret = -1;
- conn = GF_CALLOC (1, sizeof (*conn), 0);
+ conn = GF_CALLOC (1, sizeof (*conn), gf_server_mt_conn_t);
if (!conn)
goto out;
@@ -1400,7 +1401,7 @@ serialize_rsp_direntp (gf_dirent_t *entries, gfs3_readdirp_rsp *rsp)
int ret = -1;
list_for_each_entry (entry, &entries->list, list) {
- trav = GF_CALLOC (1, sizeof (*trav), 0);
+ trav = GF_CALLOC (1, sizeof (*trav), gf_server_mt_dirent_rsp_t);
if (!trav)
goto out;
@@ -1436,7 +1437,7 @@ serialize_rsp_dirent (gf_dirent_t *entries, gfs3_readdir_rsp *rsp)
int ret = -1;
list_for_each_entry (entry, &entries->list, list) {
- trav = GF_CALLOC (1, sizeof (*trav), 0);
+ trav = GF_CALLOC (1, sizeof (*trav), gf_server_mt_dirent_rsp_t);
if (!trav)
goto out;
trav->d_ino = entry->d_ino;
diff --git a/xlators/protocol/server/src/server-mem-types.h b/xlators/protocol/server/src/server-mem-types.h
index 76c5ae1ac..32f31fae7 100644
--- a/xlators/protocol/server/src/server-mem-types.h
+++ b/xlators/protocol/server/src/server-mem-types.h
@@ -30,6 +30,7 @@ enum gf_server_mem_types_ {
gf_server_mt_locker_t,
gf_server_mt_lock_table_t,
gf_server_mt_conn_t,
+ gf_server_mt_dirent_rsp_t,
gf_server_mt_rsp_buf_t,
gf_server_mt_volfile_ctx_t,
gf_server_mt_end,
diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c
index b59fd513a..bb9edab13 100644
--- a/xlators/protocol/server/src/server.c
+++ b/xlators/protocol/server/src/server.c
@@ -474,31 +474,15 @@ out:
return 0;
}
-static int32_t
-mem_acct_init (xlator_t *this)
-{
- int ret = -1;
-
- if (!this)
- return ret;
-
- ret = xlator_mem_acct_init (this, gf_server_mt_end + 1);
-
- if (ret != 0) {
- gf_log (this->name, GF_LOG_ERROR, "Memory accounting init"
- "failed");
- return ret;
- }
-
- return ret;
-}
-
int
init (xlator_t *this)
{
int32_t ret = -1;
server_conf_t *conf = NULL;
+ if (!this)
+ goto out;
+
if (this->children == NULL) {
gf_log (this->name, GF_LOG_ERROR,
"protocol/server should have subvolume");
@@ -511,11 +495,14 @@ init (xlator_t *this)
goto out;
}
- ret = mem_acct_init (this);
- if (ret)
+ ret = xlator_mem_acct_init (this, gf_server_mt_end + 1);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "Failed to Initialize memory accounting");
goto out;
+ }
- conf = GF_CALLOC (1, sizeof (server_conf_t), 0);
+ conf = GF_CALLOC (1, sizeof (server_conf_t), gf_server_mt_server_conf_t);
GF_VALIDATE_OR_GOTO(this->name, conf, out);
INIT_LIST_HEAD (&conf->conns);
diff --git a/xlators/protocol/server/src/server3_1-fops.c b/xlators/protocol/server/src/server3_1-fops.c
index 54dda8964..6dee758e7 100644
--- a/xlators/protocol/server/src/server3_1-fops.c
+++ b/xlators/protocol/server/src/server3_1-fops.c
@@ -105,7 +105,8 @@ server_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
if ((op_ret >= 0) && dict) {
- rsp.dict.dict_val = GF_CALLOC (1, rsp.dict.dict_len, 0);
+ rsp.dict.dict_val = GF_CALLOC (1, rsp.dict.dict_len,
+ gf_server_mt_rsp_buf_t);
if (!rsp.dict.dict_val) {
op_ret = -1;
op_errno = ENOMEM;
@@ -695,7 +696,8 @@ server_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
goto out;
}
- rsp.dict.dict_val = GF_CALLOC (len, sizeof (char), 0);
+ rsp.dict.dict_val = GF_CALLOC (len, sizeof (char),
+ gf_server_mt_rsp_buf_t);
if (!rsp.dict.dict_val) {
op_ret = -1;
op_errno = ENOMEM;
@@ -755,7 +757,7 @@ server_fgetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
len = 0;
goto out;
}
- rsp.dict.dict_val = GF_CALLOC (1, len, 0);
+ rsp.dict.dict_val = GF_CALLOC (1, len, gf_server_mt_rsp_buf_t);
if (!rsp.dict.dict_val) {
op_ret = -1;
op_errno = ENOMEM;
@@ -1640,7 +1642,7 @@ server_xattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
len = 0;
goto out;
}
- rsp.dict.dict_val = GF_CALLOC (1, len, 0);
+ rsp.dict.dict_val = GF_CALLOC (1, len, gf_server_mt_rsp_buf_t);
if (!rsp.dict.dict_val) {
op_ret = -1;
op_errno = ENOMEM;
@@ -1709,7 +1711,7 @@ server_fxattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
len = 0;
goto out;
}
- rsp.dict.dict_val = GF_CALLOC (1, len, 0);
+ rsp.dict.dict_val = GF_CALLOC (1, len, gf_server_mt_rsp_buf_t);
if (!rsp.dict.dict_val) {
op_ret = -1;
op_errno = ENOMEM;