diff options
Diffstat (limited to 'rpc/rpc-transport/rdma/src/rdma.c')
-rw-r--r-- | rpc/rpc-transport/rdma/src/rdma.c | 698 |
1 files changed, 404 insertions, 294 deletions
diff --git a/rpc/rpc-transport/rdma/src/rdma.c b/rpc/rpc-transport/rdma/src/rdma.c index 5fc6076f996..5a8a78817d5 100644 --- a/rpc/rpc-transport/rdma/src/rdma.c +++ b/rpc/rpc-transport/rdma/src/rdma.c @@ -22,6 +22,8 @@ #include "byte-order.h" #include "xlator.h" #include "xdr-rpc.h" +#include "rpc-lib-messages.h" +#include "rpc-trans-rdma-messages.h" #include <signal.h> #define GF_RDMA_LOG_NAME "rpc-transport/rdma" @@ -116,7 +118,8 @@ gf_rdma_new_post (rpc_transport_t *this, gf_rdma_device_t *device, int32_t len, post->buf_size, IBV_ACCESS_LOCAL_WRITE); if (!post->mr) { - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, errno, + RDMA_MSG_MR_ALOC_FAILED, "memory registration failed (%s)", strerror (errno)); goto out; @@ -324,12 +327,13 @@ __gf_rdma_create_posts (rpc_transport_t *this, int32_t count, int32_t size, priv = this->private; device = priv->device; - for (i=0 ; i<count ; i++) { + for (i = 0 ; i < count ; i++) { gf_rdma_post_t *post = NULL; post = gf_rdma_new_post (this, device, size + 2048, type); if (!post) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + RDMA_MSG_POST_CREATION_FAILED, "post creation failed"); ret = -1; break; @@ -375,9 +379,10 @@ gf_rdma_deregister_arena (struct list_head **mr_list, list_for_each_entry_safe (tmp, dummy, mr_list[i], list) { if (tmp->iobuf_arena == iobuf_arena) { if (ibv_dereg_mr(tmp->mr)) { - gf_log("rdma", GF_LOG_WARNING, - "deallocation of memory region " - "failed"); + gf_msg ("rdma", GF_LOG_WARNING, 0, + RDMA_MSG_DEREGISTER_ARENA_FAILED, + "deallocation of memory region " + "failed"); return -1; } list_del(&tmp->list); @@ -407,8 +412,10 @@ gf_rdma_register_arena (void **arg1, void *arg2) new = GF_CALLOC(1, sizeof(gf_rdma_arena_mr), gf_common_mt_rdma_arena_mr); if (new == NULL) { - gf_log ("rdma", GF_LOG_INFO, "Out of memory:" - " registering pre allocated buffer wth rdma device failed."); + gf_msg ("rdma", GF_LOG_INFO, ENOMEM, + RDMA_MSG_MR_ALOC_FAILED, "Out of " + "memory: registering pre allocated buffer " + "with rdma device failed."); return -1; } INIT_LIST_HEAD (&new->list); @@ -421,8 +428,9 @@ gf_rdma_register_arena (void **arg1, void *arg2) IBV_ACCESS_REMOTE_WRITE ); if (!mr) - gf_log("rdma", GF_LOG_WARNING, - "allocation of mr failed"); + gf_msg ("rdma", GF_LOG_WARNING, 0, + RDMA_MSG_MR_ALOC_FAILED, "allocation of mr " + "failed"); new->mr = mr; list_add (&new->list, &device[i]->all_mr); @@ -455,8 +463,10 @@ gf_rdma_register_iobuf_pool (rpc_transport_t *this) new = GF_CALLOC(1, sizeof(gf_rdma_arena_mr), gf_common_mt_rdma_arena_mr); if (new == NULL) { - gf_log ("rdma", GF_LOG_INFO, "Out of memory:" - " registering pre allocated buffer with rdma device failed."); + gf_msg ("rdma", GF_LOG_INFO, ENOMEM, + RDMA_MSG_MR_ALOC_FAILED, "Out of " + "memory: registering pre allocated " + "buffer with rdma device failed."); return; } INIT_LIST_HEAD (&new->list); @@ -468,8 +478,9 @@ gf_rdma_register_iobuf_pool (rpc_transport_t *this) IBV_ACCESS_LOCAL_WRITE | IBV_ACCESS_REMOTE_WRITE); if (!mr) { - gf_log ("rdma", GF_LOG_WARNING, "failed to pre" - " register buffers with rdma " + gf_msg ("rdma", GF_LOG_WARNING, 0, + RDMA_MSG_MR_ALOC_FAILED, "failed" + " to pre register buffers with rdma " "devices."); } @@ -529,7 +540,7 @@ gf_rdma_create_posts (rpc_transport_t *this) GF_RDMA_RECV_POST); if (!ret) { - for (i=0 ; i<options->recv_count ; i++) { + for (i = 0 ; i < options->recv_count ; i++) { post = gf_rdma_get_post (&device->recvq); if (gf_rdma_post_recv (device->srq, post) != 0) { ret = -1; @@ -586,14 +597,15 @@ gf_rdma_create_cq (rpc_transport_t *this) device->recv_chan, 0); if (!device->recv_cq) { - gf_log (this->name, GF_LOG_ERROR, - "creation of CQ for device %s failed", - device->device_name); + gf_msg (this->name, GF_LOG_ERROR, 0, + RDMA_MSG_CQ_CREATION_FAILED, "creation of CQ for " + "device %s failed", device->device_name); ret = -1; goto out; } else if (ibv_req_notify_cq (device->recv_cq, 0)) { - gf_log (this->name, GF_LOG_ERROR, - "ibv_req_notify_cq on recv CQ of device %s failed", + gf_msg (this->name, GF_LOG_ERROR, 0, + RDMA_MSG_REQ_NOTIFY_CQ_REVQ_FAILED, "ibv_req_notify_" + "cq on recv CQ of device %s failed", device->device_name); ret = -1; goto out; @@ -602,8 +614,9 @@ gf_rdma_create_cq (rpc_transport_t *this) do { ret = ibv_query_device (priv->device->context, &device_attr); if (ret != 0) { - gf_log (this->name, GF_LOG_ERROR, - "ibv_query_device on %s returned %d (%s)", + gf_msg (this->name, GF_LOG_ERROR, 0, + RDMA_MSG_QUERY_DEVICE_FAILED, "ibv_query_" + "device on %s returned %d (%s)", priv->device->device_name, ret, (ret > 0) ? strerror (ret) : ""); ret = -1; @@ -619,15 +632,17 @@ gf_rdma_create_cq (rpc_transport_t *this) send_cqe, device, device->send_chan, 0); if (!device->send_cq) { - gf_log (this->name, GF_LOG_ERROR, - "creation of send_cq for device %s failed", - device->device_name); + gf_msg (this->name, GF_LOG_ERROR, 0, + RDMA_MSG_CQ_CREATION_FAILED, + "creation of send_cq " + "for device %s failed", device->device_name); ret = -1; goto out; } if (ibv_req_notify_cq (device->send_cq, 0)) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + RDMA_MSG_REQ_NOTIFY_CQ_SENDQ_FAILED, "ibv_req_notify_cq on send_cq for device %s" " failed", device->device_name); ret = -1; @@ -706,16 +721,18 @@ gf_rdma_get_device (rpc_transport_t *this, struct ibv_context *ibctx, trav->send_chan = ibv_create_comp_channel (trav->context); if (!trav->send_chan) { - gf_log (this->name, GF_LOG_ERROR, - "could not create send completion channel for " + gf_msg (this->name, GF_LOG_ERROR, 0, + RDMA_MSG_SEND_COMP_CHAN_FAILED, "could not " + "create send completion channel for " "device (%s)", device_name); goto out; } trav->recv_chan = ibv_create_comp_channel (trav->context); if (!trav->recv_chan) { - gf_log (this->name, GF_LOG_ERROR, - "could not create recv completion channel for " + gf_msg (this->name, GF_LOG_ERROR, 0, + RDMA_MSG_RECV_COMP_CHAN_FAILED, "could not " + "create recv completion channel for " "device (%s)", device_name); /* TODO: cleanup current mess */ @@ -723,7 +740,8 @@ gf_rdma_get_device (rpc_transport_t *this, struct ibv_context *ibctx, } if (gf_rdma_create_cq (this) < 0) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + RDMA_MSG_CQ_CREATION_FAILED, "could not create CQ for device (%s)", device_name); goto out; @@ -733,9 +751,10 @@ gf_rdma_get_device (rpc_transport_t *this, struct ibv_context *ibctx, trav->pd = ibv_alloc_pd (trav->context); if (!trav->pd) { - gf_log (this->name, GF_LOG_ERROR, - "could not allocate protection domain for " - "device (%s)", device_name); + gf_msg (this->name, GF_LOG_ERROR, 0, + RDMA_MSG_ALOC_PROT_DOM_FAILED, "could not " + "allocate protection domain for device (%s)", + device_name); goto out; } @@ -749,8 +768,9 @@ gf_rdma_get_device (rpc_transport_t *this, struct ibv_context *ibctx, trav->srq = ibv_create_srq (trav->pd, &attr); if (!trav->srq) { - gf_log (this->name, GF_LOG_ERROR, - "could not create SRQ for device (%s)", + gf_msg (this->name, GF_LOG_ERROR, 0, + RDMA_MSG_CRE_SRQ_FAILED, "could not create SRQ" + " for device (%s)", device_name); goto out; } @@ -763,9 +783,9 @@ gf_rdma_get_device (rpc_transport_t *this, struct ibv_context *ibctx, gf_rdma_register_iobuf_pool(this); if (gf_rdma_create_posts (this) < 0) { - gf_log (this->name, GF_LOG_ERROR, - "could not allocate posts for device (%s)", - device_name); + gf_msg (this->name, GF_LOG_ERROR, 0, + RDMA_MSG_ALOC_POST_FAILED, "could not allocate" + "posts for device (%s)", device_name); goto out; } @@ -774,7 +794,8 @@ gf_rdma_get_device (rpc_transport_t *this, struct ibv_context *ibctx, gf_rdma_send_completion_proc, trav->send_chan); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + RDMA_MSG_SEND_COMP_THREAD_FAILED, "could not create send completion thread for " "device (%s)", device_name); goto out; @@ -784,7 +805,8 @@ gf_rdma_get_device (rpc_transport_t *this, struct ibv_context *ibctx, gf_rdma_recv_completion_proc, trav->recv_chan); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + RDMA_MSG_RECV_COMP_THREAD_FAILED, "could not create recv completion thread " "for device (%s)", device_name); return NULL; @@ -794,14 +816,15 @@ gf_rdma_get_device (rpc_transport_t *this, struct ibv_context *ibctx, gf_rdma_async_event_thread, ibctx); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + RDMA_MSG_ASYNC_EVENT_THEAD_FAILED, "could not create async_event_thread"); return NULL; } /* qpreg */ pthread_mutex_init (&trav->qpreg.lock, NULL); - for (i=0; i<42; i++) { + for (i = 0; i < 42; i++) { trav->qpreg.ents[i].next = &trav->qpreg.ents[i]; trav->qpreg.ents[i].prev = &trav->qpreg.ents[i]; } @@ -884,19 +907,20 @@ gf_rdma_transport_new (rpc_transport_t *listener, struct rdma_cm_id *cm_id) device_name = (char *)ibv_get_device_name (cm_id->verbs->device); if (device_name == NULL) { - gf_log (listener->name, GF_LOG_WARNING, - "cannot get device name (peer:%s me:%s)", - this->peerinfo.identifier, this->myinfo.identifier); + gf_msg (listener->name, GF_LOG_WARNING, 0, + RDMA_MSG_GET_DEVICE_NAME_FAILED, "cannot get device " + "name (peer:%s me:%s)", this->peerinfo.identifier, + this->myinfo.identifier); goto out; } priv->device = gf_rdma_get_device (this, cm_id->verbs, device_name); if (priv->device == NULL) { - gf_log (listener->name, GF_LOG_WARNING, - "cannot get infiniband device %s (peer:%s me:%s)", - device_name, this->peerinfo.identifier, - this->myinfo.identifier); + gf_msg (listener->name, GF_LOG_WARNING, 0, + RDMA_MSG_GET_IB_DEVICE_FAILED, "cannot get infiniband" + " device %s (peer:%s me:%s)", device_name, + this->peerinfo.identifier, this->myinfo.identifier); goto out; } @@ -950,23 +974,25 @@ gf_rdma_cm_handle_connect_request (struct rdma_cm_event *event) this = gf_rdma_transport_new (listener, child_cm_id); if (this == NULL) { - gf_log (listener->name, GF_LOG_WARNING, - "could not create a transport for incoming connection" + gf_msg (listener->name, GF_LOG_WARNING, 0, + RDMA_MSG_CREAT_INC_TRANS_FAILED, "could not create " + "a transport for incoming connection" " (me.name:%s me.identifier:%s)", listener->name, listener->myinfo.identifier); rdma_destroy_id (child_cm_id); goto out; } - gf_log (listener->name, GF_LOG_TRACE, - "got a connect request (me:%s peer:%s)", - listener->myinfo.identifier, this->peerinfo.identifier); + gf_msg_trace (listener->name, 0, "got a connect request (me:%s peer:" + "%s)", listener->myinfo.identifier, + this->peerinfo.identifier); ret = gf_rdma_create_qp (this); if (ret < 0) { - gf_log (listener->name, GF_LOG_WARNING, - "could not create QP (peer:%s me:%s)", - this->peerinfo.identifier, this->myinfo.identifier); + gf_msg (listener->name, GF_LOG_WARNING, 0, + RDMA_MSG_CREAT_QP_FAILED, "could not create QP " + "(peer:%s me:%s)", this->peerinfo.identifier, + this->myinfo.identifier); gf_rdma_cm_handle_disconnect (this); goto out; } @@ -978,8 +1004,9 @@ gf_rdma_cm_handle_connect_request (struct rdma_cm_event *event) ret = rdma_accept(child_cm_id, &conn_param); if (ret < 0) { - gf_log (listener->name, GF_LOG_WARNING, "rdma_accept failed " - "peer:%s me:%s (%s)", this->peerinfo.identifier, + gf_msg (listener->name, GF_LOG_WARNING, errno, + RDMA_MSG_ACCEPT_FAILED, "rdma_accept failed peer:%s " + "me:%s (%s)", this->peerinfo.identifier, this->myinfo.identifier, strerror (errno)); gf_rdma_cm_handle_disconnect (this); goto out; @@ -1014,9 +1041,10 @@ gf_rdma_cm_handle_route_resolved (struct rdma_cm_event *event) ret = gf_rdma_create_qp (this); if (ret != 0) { - gf_log (this->name, GF_LOG_WARNING, - "could not create QP (peer:%s me:%s)", - this->peerinfo.identifier, this->myinfo.identifier); + gf_msg (this->name, GF_LOG_WARNING, 0, + RDMA_MSG_CREAT_QP_FAILED, "could not create QP " + "(peer:%s me:%s)", this->peerinfo.identifier, + this->myinfo.identifier); gf_rdma_cm_handle_disconnect (this); goto out; } @@ -1029,14 +1057,15 @@ gf_rdma_cm_handle_route_resolved (struct rdma_cm_event *event) ret = rdma_connect(peer->cm_id, &conn_param); if (ret != 0) { - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, errno, + RDMA_MSG_CONNECT_FAILED, "rdma_connect failed (%s)", strerror (errno)); gf_rdma_cm_handle_disconnect (this); goto out; } - gf_log (this->name, GF_LOG_TRACE, "route resolved (me:%s peer:%s)", - this->myinfo.identifier, this->peerinfo.identifier); + gf_msg_trace (this->name, 0, "route resolved (me:%s peer:%s)", + this->myinfo.identifier, this->peerinfo.identifier); ret = 0; out: @@ -1071,15 +1100,16 @@ gf_rdma_cm_handle_addr_resolved (struct rdma_cm_event *event) ret = rdma_resolve_route(peer->cm_id, 2000); if (ret != 0) { - gf_log (this->name, GF_LOG_WARNING, - "rdma_resolve_route failed (me:%s peer:%s) (%s)", + gf_msg (this->name, GF_LOG_WARNING, errno, + RDMA_MSG_ROUTE_RESOLVE_FAILED, "rdma_resolve_route " + "failed (me:%s peer:%s) (%s)", this->myinfo.identifier, this->peerinfo.identifier, strerror (errno)); gf_rdma_cm_handle_disconnect (this); } - gf_log (this->name, GF_LOG_TRACE, "Address resolved (me:%s peer:%s)", - this->myinfo.identifier, this->peerinfo.identifier); + gf_msg_trace (this->name, 0, "Address resolved (me:%s peer:%s)", + this->myinfo.identifier, this->peerinfo.identifier); return ret; } @@ -1092,8 +1122,7 @@ gf_rdma_cm_handle_disconnect (rpc_transport_t *this) char need_unref = 0; priv = this->private; - gf_log (this->name, GF_LOG_DEBUG, - "peer disconnected, cleaning up"); + gf_msg_debug (this->name, 0, "peer disconnected, cleaning up"); pthread_mutex_lock (&priv->write_mutex); { @@ -1127,9 +1156,10 @@ gf_rdma_cm_handle_connect_init (struct rdma_cm_event *event) priv = this->private; if (priv->connected == 1) { - gf_log (this->name, GF_LOG_TRACE, - "received event RDMA_CM_EVENT_ESTABLISHED (me:%s peer:%s)", - this->myinfo.identifier, this->peerinfo.identifier); + gf_msg_trace (this->name, 0, "received event " + "RDMA_CM_EVENT_ESTABLISHED (me:%s peer:%s)", + this->myinfo.identifier, + this->peerinfo.identifier); return ret; } @@ -1143,9 +1173,10 @@ gf_rdma_cm_handle_connect_init (struct rdma_cm_event *event) pthread_mutex_unlock (&priv->write_mutex); if (priv->entity == GF_RDMA_CLIENT) { - gf_log (this->name, GF_LOG_TRACE, - "received event RDMA_CM_EVENT_ESTABLISHED (me:%s peer:%s)", - this->myinfo.identifier, this->peerinfo.identifier); + gf_msg_trace (this->name, 0, "received event " + "RDMA_CM_EVENT_ESTABLISHED (me:%s peer:%s)", + this->myinfo.identifier, + this->peerinfo.identifier); ret = rpc_transport_notify (this, RPC_TRANSPORT_CONNECT, this); } else if (priv->entity == GF_RDMA_SERVER) { @@ -1196,7 +1227,8 @@ gf_rdma_cm_event_handler (void *data) while (1) { ret = rdma_get_cm_event (event_channel, &event); if (ret != 0) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, errno, + RDMA_MSG_CM_EVENT_FAILED, "rdma_cm_get_event failed (%s)", strerror (errno)); break; @@ -1226,10 +1258,9 @@ gf_rdma_cm_event_handler (void *data) case RDMA_CM_EVENT_REJECTED: this = event->id->context; - gf_log (this->name, GF_LOG_WARNING, - "cma event %s, error %d (me:%s peer:%s)\n " - "Host Unreachable, Check your connection " - "with IPoIB", + gf_msg (this->name, GF_LOG_WARNING, 0, + RDMA_MSG_CM_EVENT_FAILED, "cma event %s, " + "error %d (me:%s peer:%s)\n", rdma_event_str(event->event), event->status, this->myinfo.identifier, this->peerinfo.identifier); @@ -1243,10 +1274,10 @@ gf_rdma_cm_event_handler (void *data) case RDMA_CM_EVENT_DISCONNECTED: this = event->id->context; - gf_log (this->name, GF_LOG_DEBUG, - "received disconnect (me:%s peer:%s)\n", - this->myinfo.identifier, - this->peerinfo.identifier); + gf_msg_debug (this->name, 0, "received disconnect " + "(me:%s peer:%s)\n", + this->myinfo.identifier, + this->peerinfo.identifier); rdma_ack_cm_event (event); event = NULL; @@ -1255,13 +1286,15 @@ gf_rdma_cm_event_handler (void *data) continue; case RDMA_CM_EVENT_DEVICE_REMOVAL: - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, - "device removed"); + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_CM_EVENT_FAILED, "device " + "removed"); gf_rdma_cm_handle_device_removal (event); break; default: - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_CM_EVENT_FAILED, "unhandled event: %s, ignoring", rdma_event_str(event->event)); break; @@ -1339,8 +1372,8 @@ __gf_rdma_send_error (gf_rdma_peer_t *peer, gf_rdma_ioq_t *entry, len = __gf_rdma_encode_error (peer, reply_info, entry->rpchdr, (gf_rdma_header_t *)post->buf, err); if (len == -1) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_ERROR, - "encode error returned -1"); + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_ERROR, 0, + RDMA_MSG_ENCODE_ERROR, "encode error returned -1"); goto out; } @@ -1350,7 +1383,8 @@ __gf_rdma_send_error (gf_rdma_peer_t *peer, gf_rdma_ioq_t *entry, if (!ret) { ret = len; } else { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_POST_SEND_FAILED, "gf_rdma_post_send (to %s) failed with ret = %d (%s)", peer->trans->peerinfo.identifier, ret, (ret > 0) ? strerror (ret) : ""); @@ -1400,7 +1434,8 @@ __gf_rdma_create_read_chunks_from_vector (gf_rdma_peer_t *peer, IBV_ACCESS_REMOTE_READ); } if (!mr) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, errno, + RDMA_MSG_MR_ALOC_FAILED, "memory registration failed (%s) (peer:%s)", strerror (errno), peer->trans->peerinfo.identifier); @@ -1452,7 +1487,8 @@ __gf_rdma_create_read_chunks (gf_rdma_peer_t *peer, gf_rdma_ioq_t *entry, entry->rpchdr_count, request_ctx); if (ret == -1) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_READ_CHUNK_VECTOR_FAILED, "cannot create read chunks from vector " "entry->rpchdr"); goto out; @@ -1465,7 +1501,8 @@ __gf_rdma_create_read_chunks (gf_rdma_peer_t *peer, gf_rdma_ioq_t *entry, entry->proghdr_count, request_ctx); if (ret == -1) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_READ_CHUNK_VECTOR_FAILED, "cannot create read chunks from vector " "entry->proghdr"); } @@ -1478,7 +1515,8 @@ __gf_rdma_create_read_chunks (gf_rdma_peer_t *peer, gf_rdma_ioq_t *entry, entry->prog_payload_count, request_ctx); if (ret == -1) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_READ_CHUNK_VECTOR_FAILED, "cannot create read chunks from vector" " entry->prog_payload"); } @@ -1492,7 +1530,8 @@ __gf_rdma_create_read_chunks (gf_rdma_peer_t *peer, gf_rdma_ioq_t *entry, entry->prog_payload_count, request_ctx); if (ret == -1) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_READ_CHUNK_VECTOR_FAILED, "cannot create read chunks from vector " "entry->prog_payload"); } @@ -1542,8 +1581,9 @@ __gf_rdma_create_write_chunks_from_vector (gf_rdma_peer_t *peer, } if (!mr) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, - "memory registration failed (%s) (peer:%s)", + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, errno, + RDMA_MSG_MR_ALOC_FAILED, "memory " + "registration failed (%s) (peer:%s)", strerror (errno), peer->trans->peerinfo.identifier); goto out; @@ -1584,7 +1624,8 @@ __gf_rdma_create_write_chunks (gf_rdma_peer_t *peer, gf_rdma_ioq_t *entry, if ((chunk_type == gf_rdma_replych) && ((entry->msg.request.rsphdr_count != 1) || (entry->msg.request.rsphdr_vec[0].iov_base == NULL))) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_BUFFER_ERROR, (entry->msg.request.rsphdr_count == 1) ? "chunktype specified as reply chunk but the vector " "specifying the buffer to be used for holding reply" @@ -1620,7 +1661,8 @@ __gf_rdma_create_write_chunks (gf_rdma_peer_t *peer, gf_rdma_ioq_t *entry, entry->msg.request.rsp_payload_count, request_ctx); if (ret == -1) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_WRITE_CHUNK_VECTOR_FAILED, "cannot create write chunks from vector " "entry->rpc_payload"); goto out; @@ -1650,7 +1692,8 @@ __gf_rdma_create_write_chunks (gf_rdma_peer_t *peer, gf_rdma_ioq_t *entry, entry->msg.request.rsphdr_count, request_ctx); if (ret == -1) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_WRITE_CHUNK_VECTOR_FAILED, "cannot create write chunks from vector " "entry->rpchdr"); goto out; @@ -1755,9 +1798,7 @@ __gf_rdma_request_context_destroy (gf_rdma_request_context_t *context) if (priv->connected) { ret = __gf_rdma_quota_put (peer); if (ret < 0) { - gf_log ("rdma", GF_LOG_DEBUG, - "failed to send " - "message"); + gf_msg_debug ("rdma", 0, "failed to send message"); mem_put (context); __gf_rdma_disconnect (peer->trans); goto out; @@ -1896,7 +1937,8 @@ __gf_rdma_ioq_churn_request (gf_rdma_peer_t *peer, gf_rdma_ioq_t *entry, if ((entry->msg.request.rsphdr_count != 0) && (entry->msg.request.rsp_payload_count != 0)) { ret = -1; - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_WRITE_REPLY_CHUNCK_CONFLICT, "both write-chunklist and reply-chunk cannot be " "present"); goto out; @@ -1948,7 +1990,8 @@ __gf_rdma_ioq_churn_request (gf_rdma_peer_t *peer, gf_rdma_ioq_t *entry, if (chunk_count > GF_RDMA_MAX_SEGMENTS) { ret = -1; - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_CHUNK_COUNT_GREAT_MAX_SEGMENTS, "chunk count(%d) exceeding maximum allowed RDMA " "segment count(%d)", chunk_count, GF_RDMA_MAX_SEGMENTS); goto out; @@ -1994,7 +2037,8 @@ __gf_rdma_ioq_churn_request (gf_rdma_peer_t *peer, gf_rdma_ioq_t *entry, &chunkptr, request_ctx); if (ret != 0) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_CREATE_READ_CHUNK_FAILED, "creation of read chunks failed"); goto out; } @@ -2007,7 +2051,8 @@ __gf_rdma_ioq_churn_request (gf_rdma_peer_t *peer, gf_rdma_ioq_t *entry, &chunkptr, request_ctx); if (ret != 0) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_CREATE_WRITE_REPLAY_FAILED, "creation of write/reply chunk failed"); goto out; } @@ -2041,7 +2086,8 @@ __gf_rdma_ioq_churn_request (gf_rdma_peer_t *peer, gf_rdma_ioq_t *entry, if (!ret) { ret = len; } else { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_POST_SEND_FAILED, "gf_rdma_post_send (to %s) failed with ret = %d (%s)", peer->trans->peerinfo.identifier, ret, (ret > 0) ? strerror (ret) : ""); @@ -2113,7 +2159,8 @@ __gf_rdma_send_reply_inline (gf_rdma_peer_t *peer, gf_rdma_ioq_t *entry, if (send_size > GLUSTERFS_RDMA_INLINE_THRESHOLD) { ret = __gf_rdma_send_error (peer, entry, post, reply_info, ERR_CHUNK); - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_SEND_SIZE_GREAT_INLINE_THRESHOLD, "msg size (%d) is greater than maximum size " "of msg that can be sent inlined (%d)", send_size, GLUSTERFS_RDMA_INLINE_THRESHOLD); @@ -2150,8 +2197,9 @@ __gf_rdma_send_reply_inline (gf_rdma_peer_t *peer, gf_rdma_ioq_t *entry, if (!ret) { ret = send_size; } else { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, - "posting send (to %s) failed with ret = %d (%s)", + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_POST_SEND_FAILED, "posting send (to %s) " + "failed with ret = %d (%s)", peer->trans->peerinfo.identifier, ret, (ret > 0) ? strerror (ret) : ""); gf_rdma_post_unref (post); @@ -2184,9 +2232,9 @@ __gf_rdma_reply_encode_write_chunks (gf_rdma_peer_t *peer, } if (chunk_size < payload_size) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_DEBUG, - "length of payload (%d) is exceeding the total " - "write chunk length (%d)", payload_size, chunk_size); + gf_msg_debug (GF_RDMA_LOG_NAME, 0, "length of payload (%d) is " + "exceeding the total write chunk length (%d)", + payload_size, chunk_size); goto out; } @@ -2252,9 +2300,10 @@ __gf_rdma_register_local_mr_for_rdma (gf_rdma_peer_t *peer, IBV_ACCESS_LOCAL_WRITE); } if (ctx->mr[ctx->mr_count] == NULL) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, - "registering memory for IBV_ACCESS_LOCAL_WRITE " - "failed (%s)", strerror (errno)); + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, errno, + RDMA_MSG_MR_ALOC_FAILED, + "registering memory for IBV_ACCESS_LOCAL_WRITE" + " failed (%s)", strerror (errno)); goto out; } @@ -2302,9 +2351,9 @@ __gf_rdma_write (gf_rdma_peer_t *peer, gf_rdma_post_t *post, struct iovec *vec, for ((i = *idx), (num_sge = 0); (xfer_len != 0); i++, num_sge++) { size = min (xfer_len, vec[i].iov_len); - sg_list [num_sge].addr = (unsigned long)vec[i].iov_base; - sg_list [num_sge].length = size; - sg_list [num_sge].lkey = post->ctx.mr[i]->lkey; + sg_list[num_sge].addr = (unsigned long)vec[i].iov_base; + sg_list[num_sge].length = size; + sg_list[num_sge].lkey = post->ctx.mr[i]->lkey; xfer_len -= size; } @@ -2325,8 +2374,8 @@ __gf_rdma_write (gf_rdma_peer_t *peer, gf_rdma_post_t *post, struct iovec *vec, ret = ibv_post_send(peer->qp, &wr, &bad_wr); if (ret) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, - "rdma write to " + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_WRITE_CLIENT_ERROR, "rdma write to " "client (%s) failed with ret = %d (%s)", peer->trans->peerinfo.identifier, ret, (ret > 0) ? strerror (ret) : ""); @@ -2361,7 +2410,8 @@ __gf_rdma_do_gf_rdma_write (gf_rdma_peer_t *peer, gf_rdma_post_t *post, ret = __gf_rdma_register_local_mr_for_rdma (peer, vector, count, &post->ctx); if (ret == -1) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_MR_ALOC_FAILED, "registering memory region for rdma failed"); goto out; } @@ -2378,8 +2428,9 @@ __gf_rdma_do_gf_rdma_write (gf_rdma_peer_t *peer, gf_rdma_post_t *post, &payload_idx, &reply_info->wc_array->wc_array[i]); if (ret == -1) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, - "rdma write to client (%s) failed", + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_WRITE_CLIENT_ERROR, "rdma write to " + "client (%s) failed", peer->trans->peerinfo.identifier); goto out; } @@ -2422,8 +2473,8 @@ __gf_rdma_send_reply_type_nomsg (gf_rdma_peer_t *peer, gf_rdma_ioq_t *entry, reply_info, (uint32_t **)&buf); if (ret == -1) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, - "encoding write chunks failed"); + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_ENCODE_ERROR, "encoding write chunks failed"); ret = __gf_rdma_send_error (peer, entry, post, reply_info, ERR_CHUNK); goto out; @@ -2442,18 +2493,19 @@ __gf_rdma_send_reply_type_nomsg (gf_rdma_peer_t *peer, gf_rdma_ioq_t *entry, ret = __gf_rdma_do_gf_rdma_write (peer, post, vector, count, entry->iobref, reply_info); if (ret == -1) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, - "rdma write to peer (%s) failed", - peer->trans->peerinfo.identifier); + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_WRITE_PEER_FAILED, "rdma write to peer " + "(%s) failed", peer->trans->peerinfo.identifier); gf_rdma_post_unref (post); goto out; } ret = gf_rdma_post_send (peer->qp, post, (buf - post->buf)); if (ret) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, - "posting a send request to client (%s) failed with " - "ret = %d (%s)", peer->trans->peerinfo.identifier, ret, + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_POST_SEND_FAILED, "posting a send request " + "to client (%s) failed with ret = %d (%s)", + peer->trans->peerinfo.identifier, ret, (ret > 0) ? strerror (ret) : ""); ret = -1; gf_rdma_post_unref (post); @@ -2481,7 +2533,8 @@ __gf_rdma_send_reply_type_msg (gf_rdma_peer_t *peer, gf_rdma_ioq_t *entry, + GLUSTERFS_RDMA_MAX_HEADER_SIZE; if (send_size > GLUSTERFS_RDMA_INLINE_THRESHOLD) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_SEND_SIZE_GREAT_INLINE_THRESHOLD, "client has provided only write chunks, but the " "combined size of rpc and program header (%d) is " "exceeding the size of msg that can be sent using " @@ -2506,8 +2559,8 @@ __gf_rdma_send_reply_type_msg (gf_rdma_peer_t *peer, gf_rdma_ioq_t *entry, reply_info, (uint32_t **)&ptr); if (ret == -1) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, - "encoding write chunks failed"); + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_ENCODE_ERROR, "encoding write chunks failed"); ret = __gf_rdma_send_error (peer, entry, post, reply_info, ERR_CHUNK); goto out; @@ -2522,7 +2575,8 @@ __gf_rdma_send_reply_type_msg (gf_rdma_peer_t *peer, gf_rdma_ioq_t *entry, entry->prog_payload_count, entry->iobref, reply_info); if (ret == -1) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, "rdma write to peer " + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_WRITE_PEER_FAILED, "rdma write to peer " "(%s) failed", peer->trans->peerinfo.identifier); gf_rdma_post_unref (post); goto out; @@ -2536,7 +2590,8 @@ __gf_rdma_send_reply_type_msg (gf_rdma_peer_t *peer, gf_rdma_ioq_t *entry, ret = gf_rdma_post_send (peer->qp, post, (ptr - post->buf)); if (ret) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_SEND_CLIENT_ERROR, "rdma send to client (%s) failed with ret = %d (%s)", peer->trans->peerinfo.identifier, ret, (ret > 0) ? strerror (ret) : ""); @@ -2612,7 +2667,8 @@ __gf_rdma_ioq_churn_reply (gf_rdma_peer_t *peer, gf_rdma_ioq_t *entry, ret = __gf_rdma_send_reply_inline (peer, entry, post, reply_info); if (ret < 0) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_SEND_REPLY_FAILED, "failed to send reply to peer (%s) as an " "inlined rdma msg", peer->trans->peerinfo.identifier); @@ -2623,7 +2679,8 @@ __gf_rdma_ioq_churn_reply (gf_rdma_peer_t *peer, gf_rdma_ioq_t *entry, ret = __gf_rdma_send_reply_type_nomsg (peer, entry, post, reply_info); if (ret < 0) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_SEND_REPLY_FAILED, "failed to send reply to peer (%s) as " "RDMA_NOMSG", peer->trans->peerinfo.identifier); } @@ -2633,7 +2690,8 @@ __gf_rdma_ioq_churn_reply (gf_rdma_peer_t *peer, gf_rdma_ioq_t *entry, ret = __gf_rdma_send_reply_type_msg (peer, entry, post, reply_info); if (ret < 0) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_SEND_REPLY_FAILED, "failed to send reply with write chunks " "to peer (%s)", peer->trans->peerinfo.identifier); @@ -2641,7 +2699,8 @@ __gf_rdma_ioq_churn_reply (gf_rdma_peer_t *peer, gf_rdma_ioq_t *entry, break; default: - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_INVALID_CHUNK_TYPE, "invalid chunktype (%d) specified for sending reply " " (peer:%s)", type, peer->trans->peerinfo.identifier); break; @@ -2687,7 +2746,8 @@ __gf_rdma_ioq_churn_entry (gf_rdma_peer_t *peer, gf_rdma_ioq_t *entry) if (entry->is_request) { ret = __gf_rdma_ioq_churn_request (peer, entry, post); if (ret < 0) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_PROC_IOQ_ENTRY_FAILED, "failed to process request ioq entry " "to peer(%s)", peer->trans->peerinfo.identifier); @@ -2695,7 +2755,8 @@ __gf_rdma_ioq_churn_entry (gf_rdma_peer_t *peer, gf_rdma_ioq_t *entry) } else { ret = __gf_rdma_ioq_churn_reply (peer, entry, post); if (ret < 0) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_PROC_IOQ_ENTRY_FAILED, "failed to process reply ioq entry " "to peer (%s)", peer->trans->peerinfo.identifier); @@ -2720,8 +2781,7 @@ __gf_rdma_ioq_churn (gf_rdma_peer_t *peer) gf_rdma_ioq_t *entry = NULL; int32_t ret = 0; - while (!list_empty (&peer->ioq)) - { + while (!list_empty (&peer->ioq)) { /* pick next entry */ entry = peer->ioq_next; @@ -2755,7 +2815,8 @@ gf_rdma_writev (rpc_transport_t *this, gf_rdma_ioq_t *entry) pthread_mutex_lock (&priv->write_mutex); { if (!priv->connected) { - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, 0, + RDMA_MSG_PEER_DISCONNECTED, "rdma is not connected to peer (%s)", this->peerinfo.identifier); ret = -1; @@ -2769,9 +2830,10 @@ gf_rdma_writev (rpc_transport_t *this, gf_rdma_ioq_t *entry) need_append = 0; if (ret < 0) { - gf_log (this->name, GF_LOG_WARNING, - "processing ioq entry destined " - "to (%s) failed", + gf_msg (this->name, GF_LOG_WARNING, 0, + RDMA_MSG_PROC_IOQ_ENTRY_FAILED, + "processing ioq entry destined" + " to (%s) failed", this->peerinfo.identifier); } } @@ -2914,7 +2976,8 @@ gf_rdma_submit_request (rpc_transport_t *this, rpc_transport_req_t *req) entry = gf_rdma_ioq_new (this, &data); if (entry == NULL) { - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, 0, + RDMA_MSG_NEW_IOQ_ENTRY_FAILED, "getting a new ioq entry failed (peer:%s)", this->peerinfo.identifier); goto out; @@ -2925,7 +2988,8 @@ gf_rdma_submit_request (rpc_transport_t *this, rpc_transport_req_t *req) if (ret > 0) { ret = 0; } else if (ret < 0) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_WRITE_PEER_FAILED, "sending request to peer (%s) failed", this->peerinfo.identifier); rpc_transport_disconnect (this); @@ -2950,7 +3014,8 @@ gf_rdma_submit_reply (rpc_transport_t *this, rpc_transport_reply_t *reply) entry = gf_rdma_ioq_new (this, &data); if (entry == NULL) { - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, 0, + RDMA_MSG_NEW_IOQ_ENTRY_FAILED, "getting a new ioq entry failed (peer:%s)", this->peerinfo.identifier); goto out; @@ -2960,7 +3025,8 @@ gf_rdma_submit_reply (rpc_transport_t *this, rpc_transport_reply_t *reply) if (ret > 0) { ret = 0; } else if (ret < 0) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_WRITE_PEER_FAILED, "sending request to peer (%s) failed", this->peerinfo.identifier); rpc_transport_disconnect (this); @@ -3101,7 +3167,9 @@ gf_rdma_create_qp (rpc_transport_t *this) device_name = (char *)ibv_get_device_name (peer->cm_id->verbs->device); if (device_name == NULL) { ret = -1; - gf_log (this->name, GF_LOG_WARNING, "cannot get device_name"); + gf_msg (this->name, GF_LOG_WARNING, 0, + RDMA_MSG_GET_DEVICE_NAME_FAILED, "cannot get " + "device_name"); goto out; } @@ -3109,7 +3177,8 @@ gf_rdma_create_qp (rpc_transport_t *this) device_name); if (device == NULL) { ret = -1; - gf_log (this->name, GF_LOG_WARNING, "cannot get device for " + gf_msg (this->name, GF_LOG_WARNING, 0, + RDMA_MSG_GET_DEVICE_FAILED, "cannot get device for " "device %s", device_name); goto out; } @@ -3133,9 +3202,9 @@ gf_rdma_create_qp (rpc_transport_t *this) ret = rdma_create_qp(peer->cm_id, device->pd, &init_attr); if (ret != 0) { - gf_log (peer->trans->name, GF_LOG_CRITICAL, - "%s: could not create QP (%s)", this->name, - strerror (errno)); + gf_msg (peer->trans->name, GF_LOG_CRITICAL, errno, + RDMA_MSG_CREAT_QP_FAILED, "%s: could not create QP " + "(%s)", this->name, strerror (errno)); ret = -1; goto out; } @@ -3330,8 +3399,9 @@ gf_rdma_decode_error_msg (gf_rdma_peer_t *peer, gf_rdma_post_t *post, ret = rpc_reply_to_xdr (&rpc_msg, iobuf_ptr (iobuf), iobuf_pagesize (iobuf), &post->ctx.vector[0]); if (ret == -1) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, - "Failed to create RPC reply"); + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_RPC_REPLY_CREATE_FAILED, "Failed to create " + "RPC reply"); goto out; } @@ -3372,8 +3442,9 @@ gf_rdma_decode_msg (gf_rdma_peer_t *peer, gf_rdma_post_t *post, ret = gf_rdma_get_read_chunklist (&ptr, readch); if (ret == -1) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, - "cannot get read chunklist from msg"); + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_GET_READ_CHUNK_FAILED, "cannot get read " + "chunklist from msg"); goto out; } @@ -3382,8 +3453,9 @@ gf_rdma_decode_msg (gf_rdma_peer_t *peer, gf_rdma_post_t *post, ret = gf_rdma_get_write_chunklist (&ptr, &write_ary); if (ret == -1) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, - "cannot get write chunklist from msg"); + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_GET_WRITE_CHUNK_FAILED, "cannot get write " + "chunklist from msg"); goto out; } @@ -3393,7 +3465,8 @@ gf_rdma_decode_msg (gf_rdma_peer_t *peer, gf_rdma_post_t *post, if (write_ary != NULL) { reply_info = gf_rdma_reply_info_alloc (peer); if (reply_info == NULL) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_REPLY_INFO_ALLOC_FAILED, "reply_info_alloc failed"); ret = -1; goto out; @@ -3405,15 +3478,17 @@ gf_rdma_decode_msg (gf_rdma_peer_t *peer, gf_rdma_post_t *post, } else { ret = gf_rdma_get_write_chunklist (&ptr, &write_ary); if (ret == -1) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, - "cannot get reply chunklist from msg"); + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_CHUNKLIST_ERROR, "cannot get reply " + "chunklist from msg"); goto out; } if (write_ary != NULL) { reply_info = gf_rdma_reply_info_alloc (peer); if (reply_info == NULL) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_REPLY_INFO_ALLOC_FAILED, "reply_info_alloc_failed"); ret = -1; goto out; @@ -3479,36 +3554,38 @@ gf_rdma_decode_header (gf_rdma_peer_t *peer, gf_rdma_post_t *post, case GF_RDMA_NOMSG: ret = gf_rdma_decode_msg (peer, post, readch, bytes_in_post); if (ret < 0) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, - "cannot decode msg of type (%d)", - header->rm_type); + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_ENCODE_ERROR, "cannot decode msg of " + "type (%d)", header->rm_type); } break; case GF_RDMA_MSGP: - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, - "rdma msg of msg-type GF_RDMA_MSGP should not have " - "been received"); + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_INVALID_ENTRY, "rdma msg of msg-type " + "GF_RDMA_MSGP should not have been received"); ret = -1; break; case GF_RDMA_DONE: - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, - "rdma msg of msg-type GF_RDMA_DONE should not have " - "been received"); + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_INVALID_ENTRY, "rdma msg of msg-type " + "GF_RDMA_DONE should not have been received"); ret = -1; break; case GF_RDMA_ERROR: - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, - "received a msg of type RDMA_ERROR"); + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_RDMA_ERROR_RECEIVED, "received a msg of type" + " RDMA_ERROR"); ret = gf_rdma_decode_error_msg (peer, post, bytes_in_post); break; default: - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, - "unknown rdma msg-type (%d)", header->rm_type); + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_INVALID_ENTRY, "unknown rdma msg-type (%d)", + header->rm_type); } return ret; @@ -3534,9 +3611,10 @@ gf_rdma_do_reads (gf_rdma_peer_t *peer, gf_rdma_post_t *post, } if (i == 0) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, - "message type specified as rdma-read but there are no " - "rdma read-chunks present"); + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_INVALID_CHUNK_TYPE, "message type specified " + "as rdma-read but there are no rdma read-chunks " + "present"); goto out; } @@ -3564,9 +3642,9 @@ gf_rdma_do_reads (gf_rdma_peer_t *peer, gf_rdma_post_t *post, pthread_mutex_lock (&priv->write_mutex); { if (!priv->connected) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, - "transport not connected to peer (%s), " - "not doing rdma reads", + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_PEER_DISCONNECTED, "transport not " + "connected to peer (%s), not doing rdma reads", peer->trans->peerinfo.identifier); goto unlock; } @@ -3595,7 +3673,8 @@ gf_rdma_do_reads (gf_rdma_peer_t *peer, gf_rdma_post_t *post, ret = __gf_rdma_register_local_mr_for_rdma (peer, &post->ctx.vector[count], 1, &post->ctx); if (ret == -1) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_MR_ALOC_FAILED, "registering local memory" " for rdma read failed"); goto unlock; @@ -3624,9 +3703,9 @@ gf_rdma_do_reads (gf_rdma_peer_t *peer, gf_rdma_post_t *post, wr[i-1].next = NULL; ret = ibv_post_send (peer->qp, wr, &bad_wr); if (ret) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, - "rdma read from client " - "(%s) failed with ret = %d (%s)", + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_READ_CLIENT_ERROR, "rdma read from " + "client (%s) failed with ret = %d (%s)", peer->trans->peerinfo.identifier, ret, (ret > 0) ? strerror (ret) : ""); @@ -3718,16 +3797,15 @@ gf_rdma_pollin_notify (gf_rdma_peer_t *peer, gf_rdma_post_t *post) RPC_TRANSPORT_MAP_XID_REQUEST, &request_info); if (ret == -1) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_DEBUG, - "cannot get request information from rpc " - "layer"); + gf_msg_debug (GF_RDMA_LOG_NAME, 0, "cannot get request" + "information from rpc layer"); goto out; } rpc_req = request_info.rpc_req; if (rpc_req == NULL) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_DEBUG, - "rpc request structure not found"); + gf_msg_debug (GF_RDMA_LOG_NAME, 0, "rpc request " + "structure not found"); ret = -1; goto out; } @@ -3752,8 +3830,8 @@ gf_rdma_pollin_notify (gf_rdma_peer_t *peer, gf_rdma_post_t *post) ret = rpc_transport_notify (peer->trans, RPC_TRANSPORT_MSG_RECEIVED, pollin); if (ret < 0) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, - "transport_notify failed"); + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + TRANS_MSG_TRANSPORT_ERROR, "transport_notify failed"); } out: @@ -3815,16 +3893,18 @@ gf_rdma_recv_reply (gf_rdma_peer_t *peer, gf_rdma_post_t *post) RPC_TRANSPORT_MAP_XID_REQUEST, &request_info); if (ret == -1) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, - "cannot get request information (peer:%s) from rpc " - "layer", peer->trans->peerinfo.identifier); + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + TRANS_MSG_TRANSPORT_ERROR, "cannot get request " + "information (peer:%s) from rpc layer", + peer->trans->peerinfo.identifier); goto out; } rpc_req = request_info.rpc_req; if (rpc_req == NULL) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, - "rpc request structure not found"); + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_RPC_ST_ERROR, "rpc request structure not " + "found"); ret = -1; goto out; } @@ -3842,7 +3922,8 @@ out: if (ret == 0) { ret = gf_rdma_pollin_notify (peer, post); if (ret < 0) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_POLL_IN_NOTIFY_FAILED, "pollin notify failed"); } } @@ -3860,14 +3941,16 @@ gf_rdma_recv_request (gf_rdma_peer_t *peer, gf_rdma_post_t *post, if (readch != NULL) { ret = gf_rdma_do_reads (peer, post, readch); if (ret < 0) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_PEER_READ_FAILED, "rdma read from peer (%s) failed", peer->trans->peerinfo.identifier); } } else { ret = gf_rdma_pollin_notify (peer, post); if (ret == -1) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_POLL_IN_NOTIFY_FAILED, "pollin notification failed"); } } @@ -3888,15 +3971,17 @@ gf_rdma_process_recv (gf_rdma_peer_t *peer, struct ibv_wc *wc) post = (gf_rdma_post_t *) (long) wc->wr_id; if (post == NULL) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, - "no post found in successful work completion element"); + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_POST_MISSING, "no post found in successful " + "work completion element"); goto out; } ret = gf_rdma_decode_header (peer, post, &readch, wc->byte_len); if (ret == -1) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, - "decoding of header failed"); + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_HEADER_DECODE_FAILED, "decoding of header " + "failed"); goto out; } @@ -3917,7 +4002,7 @@ gf_rdma_process_recv (gf_rdma_peer_t *peer, struct ibv_wc *wc) * instead of directly setting it to header->rm_credit. */ priv->peer.quota = header->rm_credit - - ( 1 - priv->peer.quota); + - (1 - priv->peer.quota); } } pthread_mutex_unlock (&priv->write_mutex); @@ -3938,7 +4023,8 @@ gf_rdma_process_recv (gf_rdma_peer_t *peer, struct ibv_wc *wc) case GF_RDMA_ERROR: if (header->rm_body.rm_error.rm_type == ERR_CHUNK) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_RDMA_ERROR_RECEIVED, "peer (%s), couldn't encode or decode the msg " "properly or write chunks were not provided " "for replies that were bigger than " @@ -3947,36 +4033,40 @@ gf_rdma_process_recv (gf_rdma_peer_t *peer, struct ibv_wc *wc) GLUSTERFS_RDMA_INLINE_THRESHOLD); ret = gf_rdma_pollin_notify (peer, post); if (ret == -1) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_DEBUG, - "pollin notification failed"); + gf_msg_debug (GF_RDMA_LOG_NAME, 0, "pollin " + "notification failed"); } goto out; } else { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_ERROR, - "an error has happened while transmission of " - "msg, disconnecting the transport"); + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_ERROR, 0, + TRANS_MSG_TRANSPORT_ERROR, "an error has " + "happened while transmission of msg, " + "disconnecting the transport"); ret = -1; goto out; } default: - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, - "invalid rdma msg-type (%d)", header->rm_type); + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_INVALID_ENTRY, "invalid rdma msg-type (%d)", + header->rm_type); goto out; } if (msg_type == CALL) { ret = gf_rdma_recv_request (peer, post, readch); if (ret < 0) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, - "receiving a request from peer (%s) failed", + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_PEER_REQ_FAILED, "receiving a request" + " from peer (%s) failed", peer->trans->peerinfo.identifier); } } else { ret = gf_rdma_recv_reply (peer, post); if (ret < 0) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, - "receiving a reply from peer (%s) failed", + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_PEER_REP_FAILED, "receiving a reply " + "from peer (%s) failed", peer->trans->peerinfo.identifier); } } @@ -4001,21 +4091,22 @@ gf_rdma_async_event_thread (void *context) &event); if (ret && errno != EINTR) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, - "Error getting event (%s)", - strerror (errno)); + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, errno, + RDMA_MSG_EVENT_ERROR, "Error getting " + "event (%s)", strerror (errno)); } - } while(ret && errno == EINTR); + } while (ret && errno == EINTR); switch (event.event_type) { case IBV_EVENT_SRQ_LIMIT_REACHED: - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, - "received srq_limit reached"); + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_EVENT_SRQ_LIMIT_REACHED, "received " + "srq_limit reached"); break; default: - gf_log (GF_RDMA_LOG_NAME, GF_LOG_DEBUG, - "event (%d) received", event.event_type); + gf_msg_debug (GF_RDMA_LOG_NAME, 0, "event (%d) " + "received", event.event_type); break; } @@ -4046,7 +4137,8 @@ gf_rdma_recv_completion_proc (void *data) failed = 0; ret = ibv_get_cq_event (chan, &event_cq, &event_ctx); if (ret) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_ERROR, + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_ERROR, errno, + RDMA_MSG_IBV_GET_CQ_FAILED, "ibv_get_cq_event failed, terminating recv " "thread %d (%d)", ret, errno); continue; @@ -4056,7 +4148,8 @@ gf_rdma_recv_completion_proc (void *data) ret = ibv_req_notify_cq (event_cq, 0); if (ret) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_ERROR, + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_ERROR, errno, + RDMA_MSG_IBV_REQ_NOTIFY_CQ_FAILED, "ibv_req_notify_cq on %s failed, terminating " "recv thread: %d (%d)", device->device_name, ret, errno); @@ -4091,9 +4184,10 @@ gf_rdma_recv_completion_proc (void *data) pthread_mutex_unlock (&device->qpreg.lock); if (wc[index].status != IBV_WC_SUCCESS) { - gf_log (GF_RDMA_LOG_NAME, - GF_LOG_ERROR, "recv work request " - "on `%s' returned error (%d)", + gf_msg (GF_RDMA_LOG_NAME, + GF_LOG_ERROR, 0, + RDMA_MSG_RECV_ERROR, "recv work " + "request on `%s' returned error (%d)", device->device_name, wc[index].status); failed = 1; @@ -4114,10 +4208,10 @@ gf_rdma_recv_completion_proc (void *data) &wc[index]); rpc_transport_unref (peer->trans); } else { - gf_log (GF_RDMA_LOG_NAME, - GF_LOG_DEBUG, - "could not lookup peer for qp_num: %d", - wc[index].qp_num); + gf_msg_debug (GF_RDMA_LOG_NAME, 0, + "could not lookup peer " + "for qp_num: %d", + wc[index].qp_num); } gf_rdma_post_unref (post); @@ -4125,8 +4219,8 @@ gf_rdma_recv_completion_proc (void *data) } if (ret < 0) { - gf_log (GF_RDMA_LOG_NAME, - GF_LOG_ERROR, + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_ERROR, errno, + RDMA_MSG_IBV_POLL_CQ_ERROR, "ibv_poll_cq on `%s' returned error " "(ret = %d, errno = %d)", device->device_name, ret, errno); @@ -4157,7 +4251,8 @@ gf_rdma_handle_failed_send_completion (gf_rdma_peer_t *peer, struct ibv_wc *wc) post = (gf_rdma_post_t *) (long) wc->wr_id; - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_RDMA_HANDLE_FAILED, "send work request on `%s' returned error " "wc.status = %d, wc.vendor_err = %d, post->buf = %p, " "wc.byte_len = %d, post->reused = %d", @@ -4165,12 +4260,13 @@ gf_rdma_handle_failed_send_completion (gf_rdma_peer_t *peer, struct ibv_wc *wc) wc->vendor_err, post->buf, wc->byte_len, post->reused); if (wc->status == IBV_WC_RETRY_EXC_ERR) { - gf_log ("rdma", GF_LOG_ERROR, "connection between client and" - " server not working. check by running " - "'ibv_srq_pingpong'. also make sure subnet manager" - " is running (eg: 'opensm'), or check if rdma port is " - "valid (or active) by running 'ibv_devinfo'. contact " - "Gluster Support Team if the problem persists."); + gf_msg ("rdma", GF_LOG_ERROR, 0, TRANS_MSG_TIMEOUT_EXCEEDED, + "connection between client and server not working. " + "check by running 'ibv_srq_pingpong'. also make sure " + "subnet manager is running (eg: 'opensm'), or check " + "if rdma port is valid (or active) by running " + "'ibv_devinfo'. contact Gluster Support Team if the " + "problem persists."); } if (peer) { @@ -4251,7 +4347,8 @@ gf_rdma_send_completion_proc (void *data) failed = 0; ret = ibv_get_cq_event (chan, &event_cq, &event_ctx); if (ret) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_ERROR, + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_ERROR, errno, + RDMA_MSG_IBV_GET_CQ_FAILED, "ibv_get_cq_event on failed, terminating " "send thread: %d (%d)", ret, errno); continue; @@ -4261,7 +4358,8 @@ gf_rdma_send_completion_proc (void *data) ret = ibv_req_notify_cq (event_cq, 0); if (ret) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_ERROR, + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_ERROR, errno, + RDMA_MSG_IBV_REQ_NOTIFY_CQ_FAILED, "ibv_req_notify_cq on %s failed, terminating " "send thread: %d (%d)", device->device_name, ret, errno); @@ -4323,10 +4421,9 @@ gf_rdma_send_completion_proc (void *data) quota_ret = gf_rdma_quota_put (peer); if (quota_ret < 0) { - gf_log ("rdma", - GF_LOG_DEBUG, - "failed to send " - "message"); + gf_msg_debug ("rdma", + 0, "failed to send " + "message"); } } } @@ -4334,7 +4431,7 @@ gf_rdma_send_completion_proc (void *data) if (peer) { rpc_transport_unref (peer->trans); } else { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_DEBUG, + gf_msg_debug (GF_RDMA_LOG_NAME, 0, "could not lookup peer for qp_num: %d", wc[index].qp_num); @@ -4343,7 +4440,8 @@ gf_rdma_send_completion_proc (void *data) } if (ret < 0) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_ERROR, + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_ERROR, errno, + RDMA_MSG_IBV_POLL_CQ_ERROR, "ibv_poll_cq on `%s' returned error (ret = %d," " errno = %d)", device->device_name, ret, errno); @@ -4414,26 +4512,30 @@ gf_rdma_options_init (rpc_transport_t *this) if (temp) mtu = data_to_int32 (temp); switch (mtu) { + case 256: options->mtu = IBV_MTU_256; break; + case 512: options->mtu = IBV_MTU_512; break; + case 1024: options->mtu = IBV_MTU_1024; break; + case 2048: options->mtu = IBV_MTU_2048; break; + case 4096: options->mtu = IBV_MTU_4096; break; default: if (temp) - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, - "%s: unrecognized MTU value '%s', defaulting " - "to '2048'", this->name, - data_to_str (temp)); + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, 0, + RDMA_MSG_UNRECG_MTU_VALUE, "%s: unrecognized " + "MTU value '%s', defaulting to '2048'", + this->name, data_to_str (temp)); else - gf_log (GF_RDMA_LOG_NAME, GF_LOG_TRACE, - "%s: defaulting MTU to '2048'", - this->name); + gf_msg_trace (GF_RDMA_LOG_NAME, 0, "%s: defaulting " + "MTU to '2048'", this->name); options->mtu = IBV_MTU_2048; break; } @@ -4460,9 +4562,9 @@ __gf_rdma_ctx_create (void) rdma_ctx->rdma_cm_event_channel = rdma_create_event_channel (); if (rdma_ctx->rdma_cm_event_channel == NULL) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, - "rdma_cm event channel creation failed (%s)", - strerror (errno)); + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, errno, + RDMA_MSG_CM_EVENT_FAILED, "rdma_cm event channel " + "creation failed (%s)", strerror (errno)); goto out; } @@ -4470,9 +4572,9 @@ __gf_rdma_ctx_create (void) gf_rdma_cm_event_handler, rdma_ctx->rdma_cm_event_channel); if (ret != 0) { - gf_log (GF_RDMA_LOG_NAME, GF_LOG_WARNING, - "creation of thread to handle rdma-cm events " - "failed (%s)", strerror (ret)); + gf_msg (GF_RDMA_LOG_NAME, GF_LOG_WARNING, ret, + RDMA_MSG_CM_EVENT_FAILED, "creation of thread to " + "handle rdma-cm events failed (%s)", strerror (ret)); goto out; } @@ -4497,7 +4599,7 @@ gf_rdma_init (rpc_transport_t *this) glusterfs_ctx_t *ctx = NULL; gf_rdma_options_t *options = NULL; - ctx= this->ctx; + ctx = this->ctx; priv = this->private; @@ -4574,8 +4676,8 @@ gf_rdma_connect (struct rpc_transport *this, int port) &sock_union.sa, &sockaddr_len, port); if (ret != 0) { - gf_log (this->name, GF_LOG_DEBUG, - "cannot get remote address to connect"); + gf_msg_debug (this->name, 0, "cannot get remote address to " + "connect"); goto out; } @@ -4595,9 +4697,9 @@ gf_rdma_connect (struct rpc_transport *this, int port) ret = rdma_create_id (rdma_ctx->rdma_cm_event_channel, &peer->cm_id, this, RDMA_PS_TCP); if (ret != 0) { - gf_log (this->name, GF_LOG_ERROR, - "creation of rdma_cm_id failed (%s)", - strerror (errno)); + gf_msg (this->name, GF_LOG_ERROR, errno, + RDMA_MSG_CM_EVENT_FAILED, "creation of " + "rdma_cm_id failed (%s)", strerror (errno)); ret = -errno; goto unlock; } @@ -4617,7 +4719,8 @@ gf_rdma_connect (struct rpc_transport *this, int port) &this->myinfo.sockaddr_len, peer->cm_id); if (ret != 0) { - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, errno, + RDMA_MSG_CLIENT_BIND_FAILED, "client bind failed: %s", strerror (errno)); goto unlock; } @@ -4625,7 +4728,8 @@ gf_rdma_connect (struct rpc_transport *this, int port) ret = rdma_resolve_addr (peer->cm_id, NULL, &sock_union.sa, 2000); if (ret != 0) { - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, errno, + RDMA_MSG_RDMA_RESOLVE_ADDR_FAILED, "rdma_resolve_addr failed (%s)", strerror (errno)); goto unlock; @@ -4671,7 +4775,8 @@ gf_rdma_listen (rpc_transport_t *this) ret = gf_rdma_server_get_local_sockaddr (this, &sock_union.sa, &sockaddr_len); if (ret != 0) { - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, 0, + RDMA_MSG_NW_ADDR_UNKNOWN, "cannot find network address of server to bind to"); goto err; } @@ -4679,9 +4784,9 @@ gf_rdma_listen (rpc_transport_t *this) ret = rdma_create_id (rdma_ctx->rdma_cm_event_channel, &peer->cm_id, this, RDMA_PS_TCP); if (ret != 0) { - gf_log (this->name, GF_LOG_WARNING, - "creation of rdma_cm_id failed (%s)", - strerror (errno)); + gf_msg (this->name, GF_LOG_WARNING, errno, + RDMA_MSG_CM_EVENT_FAILED, "creation of rdma_cm_id " + "failed (%s)", strerror (errno)); goto err; } @@ -4694,7 +4799,8 @@ gf_rdma_listen (rpc_transport_t *this) service, sizeof (service), NI_NUMERICHOST); if (ret != 0) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, ret, + TRANS_MSG_GET_NAME_INFO_FAILED, "getnameinfo failed (%s)", gai_strerror (ret)); goto err; } @@ -4705,21 +4811,24 @@ gf_rdma_listen (rpc_transport_t *this) RDMA_OPTION_ID_REUSEADDR, (void *)&optval, sizeof(optval)); if (ret != 0) { - gf_log (this->name, GF_LOG_WARNING, - "rdma option set failed (%s)", strerror (errno)); + gf_msg (this->name, GF_LOG_WARNING, errno, + RDMA_MSG_OPTION_SET_FAILED, "rdma option set failed " + "(%s)", strerror (errno)); goto err; } ret = rdma_bind_addr (peer->cm_id, &sock_union.sa); if (ret != 0) { - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, errno, + RDMA_MSG_RDMA_BIND_ADDR_FAILED, "rdma_bind_addr failed (%s)", strerror (errno)); goto err; } ret = rdma_listen (peer->cm_id, 10); if (ret != 0) { - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, errno, + RDMA_MSG_LISTEN_FAILED, "rdma_listen failed (%s)", strerror (errno)); goto err; } @@ -4761,7 +4870,8 @@ init (rpc_transport_t *this) this->private = priv; if (gf_rdma_init (this)) { - gf_log (this->name, GF_LOG_WARNING, + gf_msg (this->name, GF_LOG_WARNING, 0, + RDMA_MSG_INIT_IB_DEVICE_FAILED, "Failed to initialize IB Device"); this->private = NULL; GF_FREE (priv); @@ -4794,8 +4904,8 @@ fini (struct rpc_transport *this) pthread_mutex_destroy (&priv->recv_mutex); pthread_mutex_destroy (&priv->write_mutex); - gf_log (this->name, GF_LOG_TRACE, - "called fini on transport: %p", this); + gf_msg_trace (this->name, 0, + "called fini on transport: %p", this); GF_FREE (priv); } |