summaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2010-08-04 05:27:55 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-08-06 03:37:15 -0700
commit21e4580c24b3e4a1270ad482e1d905afffb00fba (patch)
tree1f62cfe92410fba3e9be6e102eb1a83cc3cca99e /rpc
parentc6c504df9843d273805636df5f88aed8cde694b5 (diff)
remove same process transport shortcutting mechanism in rpc
Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 1223 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1223
Diffstat (limited to 'rpc')
-rw-r--r--rpc/rpc-lib/src/rpc-transport.c168
-rw-r--r--rpc/rpc-lib/src/rpc-transport.h24
2 files changed, 0 insertions, 192 deletions
diff --git a/rpc/rpc-lib/src/rpc-transport.c b/rpc/rpc-lib/src/rpc-transport.c
index b8ef434503b..42274ed8d5f 100644
--- a/rpc/rpc-lib/src/rpc-transport.c
+++ b/rpc/rpc-lib/src/rpc-transport.c
@@ -804,43 +804,6 @@ err:
return NULL;
}
-
-rpc_transport_handover_t *
-rpc_transport_handover_alloc (rpc_transport_pollin_t *pollin)
-{
- rpc_transport_handover_t *msg = NULL;
-
- 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;
- }
-
- msg->pollin = pollin;
- INIT_LIST_HEAD (&msg->list);
-out:
- return msg;
-}
-
-
-void
-rpc_transport_handover_destroy (rpc_transport_handover_t *msg)
-{
- if (!msg) {
- goto out;
- }
-
- if (msg->pollin) {
- rpc_transport_pollin_destroy (msg->pollin);
- }
-
- GF_FREE (msg);
-
-out:
- return;
-}
-
-
rpc_transport_t *
rpc_transport_load (glusterfs_ctx_t *ctx, dict_t *options, char *trans_name)
{
@@ -1021,52 +984,6 @@ int32_t
rpc_transport_submit_request (rpc_transport_t *this, rpc_transport_req_t *req)
{
int32_t ret = -1;
- rpc_transport_t *peer_trans = NULL;
- rpc_transport_pollin_t *pollin = NULL;
- rpc_transport_handover_t *handover_msg = NULL;
- rpc_transport_rsp_t *rsp = NULL;
-
- if (this->peer_trans) {
- peer_trans = this->peer_trans;
-
- rsp = GF_CALLOC (1, sizeof (*rsp), gf_common_mt_rpc_trans_rsp_t);
- if (!rsp) {
- ret = -ENOMEM;
- goto fail;
- }
-
- *rsp = req->rsp;
-
- pollin = rpc_transport_same_process_pollin_alloc (this, req->msg.rpchdr,
- req->msg.rpchdrcount,
- req->msg.proghdr,
- req->msg.proghdrcount,
- req->msg.progpayload,
- req->msg.progpayloadcount,
- rsp, 1);
- if (!pollin) {
- GF_FREE (rsp);
- ret = -ENOMEM;
- goto fail;
- }
-
- handover_msg = rpc_transport_handover_alloc (pollin);
- if (!handover_msg) {
- rpc_transport_pollin_destroy (pollin);
- ret = -ENOMEM;
- goto fail;
- }
-
- pthread_mutex_lock (&peer_trans->handover.mutex);
- {
- list_add_tail (&handover_msg->list,
- &peer_trans->handover.msgs);
- pthread_cond_broadcast (&peer_trans->handover.cond);
- }
- pthread_mutex_unlock (&peer_trans->handover.mutex);
-
- return 0;
- }
GF_VALIDATE_OR_GOTO("rpc_transport", this, fail);
GF_VALIDATE_OR_GOTO("rpc_transport", this->ops, fail);
@@ -1081,40 +998,6 @@ int32_t
rpc_transport_submit_reply (rpc_transport_t *this, rpc_transport_reply_t *reply)
{
int32_t ret = -1;
- rpc_transport_t *peer_trans = NULL;
- rpc_transport_pollin_t *pollin = NULL;
- rpc_transport_handover_t *handover_msg = NULL;
-
- if (this->peer_trans) {
- peer_trans = this->peer_trans;
-
- pollin = rpc_transport_same_process_pollin_alloc (this, reply->msg.rpchdr,
- reply->msg.rpchdrcount,
- reply->msg.proghdr,
- reply->msg.proghdrcount,
- reply->msg.progpayload,
- reply->msg.progpayloadcount,
- reply->private, 0);
- if (!pollin) {
- return -ENOMEM;
- }
-
- handover_msg = rpc_transport_handover_alloc (pollin);
- if (!handover_msg) {
- rpc_transport_pollin_destroy (pollin);
- return -ENOMEM;
- }
-
- pthread_mutex_lock (&peer_trans->handover.mutex);
- {
- list_add_tail (&handover_msg->list,
- &peer_trans->handover.msgs);
- pthread_cond_broadcast (&peer_trans->handover.cond);
- }
- pthread_mutex_unlock (&peer_trans->handover.mutex);
-
- return 0;
- }
GF_VALIDATE_OR_GOTO("rpc_transport", this, fail);
GF_VALIDATE_OR_GOTO("rpc_transport", this->ops, fail);
@@ -1244,57 +1127,6 @@ out:
}
-void *
-rpc_transport_peerproc (void *trans_data)
-{
- rpc_transport_t *trans = NULL;
- rpc_transport_handover_t *msg = NULL;
-
- trans = trans_data;
-
- while (1) {
- pthread_mutex_lock (&trans->handover.mutex);
- {
- while (list_empty (&trans->handover.msgs))
- pthread_cond_wait (&trans->handover.cond,
- &trans->handover.mutex);
-
- msg = list_entry (trans->handover.msgs.next,
- rpc_transport_handover_t, list);
-
- list_del_init (&msg->list);
- }
- pthread_mutex_unlock (&trans->handover.mutex);
-
- rpc_transport_notify (trans, RPC_TRANSPORT_MSG_RECEIVED,
- msg->pollin);
- rpc_transport_handover_destroy (msg);
- }
-}
-
-
-int
-rpc_transport_setpeer (rpc_transport_t *trans, rpc_transport_t *peer_trans)
-{
- trans->peer_trans = rpc_transport_ref (peer_trans);
-
- INIT_LIST_HEAD (&trans->handover.msgs);
- pthread_cond_init (&trans->handover.cond, NULL);
- pthread_mutex_init (&trans->handover.mutex, NULL);
- pthread_create (&trans->handover.thread, NULL,
- rpc_transport_peerproc, trans);
-
- peer_trans->peer_trans = rpc_transport_ref (trans);
-
- INIT_LIST_HEAD (&peer_trans->handover.msgs);
- pthread_cond_init (&peer_trans->handover.cond, NULL);
- pthread_mutex_init (&peer_trans->handover.mutex, NULL);
- pthread_create (&peer_trans->handover.thread, NULL,
- rpc_transport_peerproc, peer_trans);
-
- return 0;
-}
-
inline int
rpc_transport_register_notify (rpc_transport_t *trans,
diff --git a/rpc/rpc-lib/src/rpc-transport.h b/rpc/rpc-lib/src/rpc-transport.h
index 5698b287cce..69a768d7283 100644
--- a/rpc/rpc-lib/src/rpc-transport.h
+++ b/rpc/rpc-lib/src/rpc-transport.h
@@ -181,29 +181,8 @@ struct rpc_transport {
void *notify_data;
peer_info_t peerinfo;
peer_info_t myinfo;
-
- rpc_transport_t *peer_trans;
- struct {
- pthread_mutex_t mutex;
- pthread_cond_t cond;
- pthread_t thread;
- struct list_head msgs;
- /* any request/reply will be transformed as pollin data on the
- * peer, hence we are building up a pollin data even before
- * handing it over to peer rpc_transport. In order to decide whether
- * the pollin data is vectored or simple, we follow a simple
- * algo i.e., if there is a progpayload in request/reply, its
- * considered vectored, otherwise its a simple pollin data.
- */
- rpc_transport_pollin_t *msg;
- } handover;
};
-typedef struct {
- rpc_transport_pollin_t *pollin;
- struct list_head list;
-} rpc_transport_handover_t;
-
struct rpc_transport_ops {
/* no need of receive op, msg will be delivered through an event
* notification
@@ -261,9 +240,6 @@ int32_t
rpc_transport_unref (rpc_transport_t *trans);
int
-rpc_transport_setpeer (rpc_transport_t *trans, rpc_transport_t *trans_peer);
-
-int
rpc_transport_register_notify (rpc_transport_t *trans, rpc_transport_notify_t,
void *mydata);