summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/rpc
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 /xlators/protocol/rpc
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
Diffstat (limited to 'xlators/protocol/rpc')
-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
5 files changed, 29 insertions, 21 deletions
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",