summaryrefslogtreecommitdiff
path: root/ctdb/ib
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2008-02-04 20:07:15 +1100
committerAndrew Tridgell <tridge@samba.org>2008-02-04 20:07:15 +1100
commitf6e53f433bf8e184ffc281f14c4eacda1ffc935c (patch)
tree577c389c61b4a0d7b51fbf0a0294cbd84bc79f48 /ctdb/ib
parent9d6ac0cf559535e8ac7082125692afd287b353e5 (diff)
downloadsamba-f6e53f433bf8e184ffc281f14c4eacda1ffc935c.tar.gz
merge from ronnie
(This used to be ctdb commit e7b57d38cf7255be823a223cf15b7526285b4f1c)
Diffstat (limited to 'ctdb/ib')
-rw-r--r--ctdb/ib/ibw_ctdb.c6
-rw-r--r--ctdb/ib/ibw_ctdb_init.c14
-rw-r--r--ctdb/ib/ibwrapper.c44
-rw-r--r--ctdb/ib/ibwrapper_test.c28
4 files changed, 46 insertions, 46 deletions
diff --git a/ctdb/ib/ibw_ctdb.c b/ctdb/ib/ibw_ctdb.c
index d931c2dd0f2..fd577ffdce4 100644
--- a/ctdb/ib/ibw_ctdb.c
+++ b/ctdb/ib/ibw_ctdb.c
@@ -56,13 +56,13 @@ int ctdb_ibw_node_connect(struct ctdb_node *node)
sock_out.sin_port = htons(node->address.port);
sock_out.sin_family = PF_INET;
if (ctdb_ibw_get_address(node->ctdb, node->address.address, &sock_out.sin_addr)) {
- DEBUG(0, ("ctdb_ibw_node_connect failed\n"));
+ DEBUG(DEBUG_ERR, ("ctdb_ibw_node_connect failed\n"));
return -1;
}
rc = ibw_connect(cn->conn, &sock_out, node);
if (rc) {
- DEBUG(0, ("ctdb_ibw_node_connect/ibw_connect failed - retrying...\n"));
+ DEBUG(DEBUG_ERR, ("ctdb_ibw_node_connect/ibw_connect failed - retrying...\n"));
/* try again once a second */
event_add_timed(node->ctdb->ev, node, timeval_current_ofs(1, 0),
ctdb_ibw_node_connect_event, node);
@@ -92,7 +92,7 @@ int ctdb_ibw_connstate_handler(struct ibw_ctx *ctx, struct ibw_conn *conn)
case IBWS_CONNECT_REQUEST: /* after [IBWS_READY + incoming request] */
/* => [(ibw_accept)IBWS_READY | (ibw_disconnect)STOPPED | ERROR] */
if (ibw_accept(ctx, conn, NULL)) {
- DEBUG(0, ("connstate_handler/ibw_accept failed\n"));
+ DEBUG(DEBUG_ERR, ("connstate_handler/ibw_accept failed\n"));
return -1;
} /* else continue in IBWC_CONNECTED */
break;
diff --git a/ctdb/ib/ibw_ctdb_init.c b/ctdb/ib/ibw_ctdb_init.c
index d1693550c14..2f4fbfe3f26 100644
--- a/ctdb/ib/ibw_ctdb_init.c
+++ b/ctdb/ib/ibw_ctdb_init.c
@@ -41,12 +41,12 @@ static int ctdb_ibw_listen(struct ctdb_context *ctdb, int backlog)
return -1;
if (ibw_bind(ictx, &my_addr)) {
- DEBUG(0, ("ctdb_ibw_listen: ibw_bind failed\n"));
+ DEBUG(DEBUG_CRIT, ("ctdb_ibw_listen: ibw_bind failed\n"));
return -1;
}
if (ibw_listen(ictx, backlog)) {
- DEBUG(0, ("ctdb_ibw_listen: ibw_listen failed\n"));
+ DEBUG(DEBUG_CRIT, ("ctdb_ibw_listen: ibw_listen failed\n"));
return -1;
}
@@ -82,7 +82,7 @@ static int ctdb_ibw_initialise(struct ctdb_context *ctdb)
for (i=0; i<ctdb->num_nodes; i++) {
if (ctdb_ibw_add_node(ctdb->nodes[i]) != 0) {
- DEBUG(0, ("methods->add_node failed at %d\n", i));
+ DEBUG(DEBUG_CRIT, ("methods->add_node failed at %d\n", i));
return -1;
}
}
@@ -118,7 +118,7 @@ static int ctdb_ibw_send_pkt(struct ibw_conn *conn, uint8_t *data, uint32_t leng
void *buf, *key;
if (ibw_alloc_send_buf(conn, &buf, &key, length)) {
- DEBUG(0, ("queue_pkt/ibw_alloc_send_buf failed\n"));
+ DEBUG(DEBUG_ERR, ("queue_pkt/ibw_alloc_send_buf failed\n"));
return -1;
}
@@ -156,7 +156,7 @@ static int ctdb_ibw_queue_pkt(struct ctdb_node *node, uint8_t *data, uint32_t le
assert(cn!=NULL);
if (cn->conn==NULL) {
- DEBUG(0, ("ctdb_ibw_queue_pkt: conn is NULL\n"));
+ DEBUG(DEBUG_ERR, ("ctdb_ibw_queue_pkt: conn is NULL\n"));
return -1;
}
@@ -180,7 +180,7 @@ static int ctdb_ibw_queue_pkt(struct ctdb_node *node, uint8_t *data, uint32_t le
static void ctdb_ibw_restart(struct ctdb_node *node)
{
/* TODO: implement this method for IB */
- DEBUG(0,("WARNING: method restart is not yet implemented for IB\n"));
+ DEBUG(DEBUG_ALERT,("WARNING: method restart is not yet implemented for IB\n"));
}
/*
@@ -232,7 +232,7 @@ int ctdb_ibw_init(struct ctdb_context *ctdb)
ctdb->ev);
if (ictx==NULL) {
- DEBUG(0, ("ctdb_ibw_init: ibw_init failed\n"));
+ DEBUG(DEBUG_CRIT, ("ctdb_ibw_init: ibw_init failed\n"));
return -1;
}
diff --git a/ctdb/ib/ibwrapper.c b/ctdb/ib/ibwrapper.c
index 981ac5af83e..5a166e5353f 100644
--- a/ctdb/ib/ibwrapper.c
+++ b/ctdb/ib/ibwrapper.c
@@ -346,7 +346,7 @@ static int ibw_refill_cq_recv(struct ibw_conn *conn)
rc = ibv_post_recv(pconn->cm_id->qp, &wr, &bad_wr);
if (rc) {
sprintf(ibw_lasterr, "refill/ibv_post_recv failed with %d\n", rc);
- DEBUG(0, (ibw_lasterr));
+ DEBUG(DEBUG_ERR, (ibw_lasterr));
return -2;
}
@@ -380,7 +380,7 @@ static int ibw_fill_cq(struct ibw_conn *conn)
rc = ibv_post_recv(pconn->cm_id->qp, &wr, &bad_wr);
if (rc) {
sprintf(ibw_lasterr, "fill/ibv_post_recv failed with %d\n", rc);
- DEBUG(0, (ibw_lasterr));
+ DEBUG(DEBUG_ERR, (ibw_lasterr));
return -2;
}
}
@@ -480,7 +480,7 @@ static void ibw_event_handler_cm(struct event_context *ev,
if (!pconn->is_accepted) {
rc = rdma_reject(cma_id, NULL, 0);
if (rc)
- DEBUG(0, ("rdma_reject failed with rc=%d\n", rc));
+ DEBUG(DEBUG_ERR, ("rdma_reject failed with rc=%d\n", rc));
talloc_free(conn);
DEBUG(DEBUG_DEBUG, ("pconn->cm_id %p wasn't accepted\n", pconn->cm_id));
}
@@ -523,7 +523,7 @@ static void ibw_event_handler_cm(struct event_context *ev,
if (conn) {
/* must be done BEFORE connstate */
if ((rc=rdma_ack_cm_event(event)))
- DEBUG(0, ("reject/rdma_ack_cm_event failed with %d\n", rc));
+ DEBUG(DEBUG_ERR, ("reject/rdma_ack_cm_event failed with %d\n", rc));
event = NULL; /* not to touch cma_id or conn */
conn->state = IBWC_ERROR;
/* it should free the conn */
@@ -534,11 +534,11 @@ static void ibw_event_handler_cm(struct event_context *ev,
case RDMA_CM_EVENT_DISCONNECTED:
DEBUG(DEBUG_DEBUG, ("RDMA_CM_EVENT_DISCONNECTED\n"));
if ((rc=rdma_ack_cm_event(event)))
- DEBUG(0, ("disc/rdma_ack_cm_event failed with %d\n", rc));
+ DEBUG(DEBUG_ERR, ("disc/rdma_ack_cm_event failed with %d\n", rc));
event = NULL; /* don't ack more */
if (cma_id!=pctx->cm_id) {
- DEBUG(0, ("client DISCONNECT event cm_id=%p\n", cma_id));
+ DEBUG(DEBUG_ERR, ("client DISCONNECT event cm_id=%p\n", cma_id));
conn = talloc_get_type(cma_id->context, struct ibw_conn);
conn->state = IBWC_DISCONNECTED;
pctx->connstate_func(NULL, conn);
@@ -561,7 +561,7 @@ static void ibw_event_handler_cm(struct event_context *ev,
return;
error:
- DEBUG(0, ("cm event handler: %s", ibw_lasterr));
+ DEBUG(DEBUG_ERR, ("cm event handler: %s", ibw_lasterr));
if (event!=NULL) {
if (cma_id!=NULL && cma_id!=pctx->cm_id) {
@@ -576,7 +576,7 @@ error:
}
if ((rc=rdma_ack_cm_event(event))!=0) {
- DEBUG(0, ("rdma_ack_cm_event failed with %d\n", rc));
+ DEBUG(DEBUG_ERR, ("rdma_ack_cm_event failed with %d\n", rc));
}
}
@@ -657,7 +657,7 @@ static void ibw_event_handler_verbs(struct event_context *ev,
error:
ibv_ack_cq_events(pconn->cq, 1);
- DEBUG(0, (ibw_lasterr));
+ DEBUG(DEBUG_ERR, (ibw_lasterr));
if (conn->state!=IBWC_ERROR) {
conn->state = IBWC_ERROR;
@@ -895,7 +895,7 @@ static int ibw_wc_recv(struct ibw_conn *conn, struct ibv_wc *wc)
return 0;
error:
- DEBUG(0, ("ibw_wc_recv error: %s", ibw_lasterr));
+ DEBUG(DEBUG_ERR, ("ibw_wc_recv error: %s", ibw_lasterr));
return -1;
}
@@ -993,7 +993,7 @@ struct ibw_ctx *ibw_init(struct ibw_initattr *attr, int nattr,
return ctx;
/* don't put code here */
cleanup:
- DEBUG(0, (ibw_lasterr));
+ DEBUG(DEBUG_ERR, (ibw_lasterr));
if (ctx)
talloc_free(ctx);
@@ -1031,7 +1031,7 @@ int ibw_bind(struct ibw_ctx *ctx, struct sockaddr_in *my_addr)
rc = rdma_bind_addr(pctx->cm_id, (struct sockaddr *) my_addr);
if (rc) {
sprintf(ibw_lasterr, "rdma_bind_addr error %d\n", rc);
- DEBUG(0, (ibw_lasterr));
+ DEBUG(DEBUG_ERR, (ibw_lasterr));
return rc;
}
DEBUG(DEBUG_DEBUG, ("rdma_bind_addr successful\n"));
@@ -1048,7 +1048,7 @@ int ibw_listen(struct ibw_ctx *ctx, int backlog)
rc = rdma_listen(pctx->cm_id, backlog);
if (rc) {
sprintf(ibw_lasterr, "rdma_listen failed: %d\n", rc);
- DEBUG(0, (ibw_lasterr));
+ DEBUG(DEBUG_ERR, (ibw_lasterr));
return rc;
}
@@ -1070,7 +1070,7 @@ int ibw_accept(struct ibw_ctx *ctx, struct ibw_conn *conn, void *conn_userdata)
rc = rdma_accept(pconn->cm_id, &conn_param);
if (rc) {
sprintf(ibw_lasterr, "rdma_accept failed %d\n", rc);
- DEBUG(0, (ibw_lasterr));
+ DEBUG(DEBUG_ERR, (ibw_lasterr));
return -1;;
}
@@ -1096,7 +1096,7 @@ int ibw_connect(struct ibw_conn *conn, struct sockaddr_in *serv_addr, void *conn
/* clean previous - probably half - initialization */
if (ibw_conn_priv_destruct(pconn)) {
- DEBUG(0, ("ibw_connect/ibw_pconn_destruct failed for cm_id=%p\n", pconn->cm_id));
+ DEBUG(DEBUG_ERR, ("ibw_connect/ibw_pconn_destruct failed for cm_id=%p\n", pconn->cm_id));
return -1;
}
@@ -1117,7 +1117,7 @@ int ibw_connect(struct ibw_conn *conn, struct sockaddr_in *serv_addr, void *conn
rc = rdma_resolve_addr(pconn->cm_id, NULL, (struct sockaddr *) serv_addr, 2000);
if (rc) {
sprintf(ibw_lasterr, "rdma_resolve_addr error %d\n", rc);
- DEBUG(0, (ibw_lasterr));
+ DEBUG(DEBUG_ERR, (ibw_lasterr));
talloc_free(conn);
return -1;
}
@@ -1144,7 +1144,7 @@ int ibw_disconnect(struct ibw_conn *conn)
rc = rdma_disconnect(pconn->cm_id);
if (rc) {
sprintf(ibw_lasterr, "ibw_disconnect failed with %d\n", rc);
- DEBUG(0, (ibw_lasterr));
+ DEBUG(DEBUG_ERR, (ibw_lasterr));
return rc;
}
break;
@@ -1194,9 +1194,9 @@ int ibw_alloc_send_buf(struct ibw_conn *conn, void **buf, void **key, uint32_t l
pconn->extra_max++;
switch(pconn->extra_max) {
case 1: DEBUG(DEBUG_INFO, ("warning: queue performed\n")); break;
- case 10: DEBUG(0, ("warning: queue reached 10\n")); break;
- case 100: DEBUG(0, ("warning: queue reached 100\n")); break;
- case 1000: DEBUG(0, ("warning: queue reached 1000\n")); break;
+ case 10: DEBUG(DEBUG_INFO, ("warning: queue reached 10\n")); break;
+ case 100: DEBUG(DEBUG_INFO, ("warning: queue reached 100\n")); break;
+ case 1000: DEBUG(DEBUG_INFO, ("warning: queue reached 1000\n")); break;
default: break;
}
}
@@ -1218,7 +1218,7 @@ int ibw_alloc_send_buf(struct ibw_conn *conn, void **buf, void **key, uint32_t l
return 0;
error:
- DEBUG(0, ("ibw_alloc_send_buf error: %s", ibw_lasterr));
+ DEBUG(DEBUG_ERR, ("ibw_alloc_send_buf error: %s", ibw_lasterr));
return -1;
}
@@ -1282,7 +1282,7 @@ static int ibw_send_packet(struct ibw_conn *conn, void *buf, struct ibw_wr *p, u
return 0;
error:
- DEBUG(0, (ibw_lasterr));
+ DEBUG(DEBUG_ERR, (ibw_lasterr));
return -1;
}
diff --git a/ctdb/ib/ibwrapper_test.c b/ctdb/ib/ibwrapper_test.c
index ed5ab963676..cbd4f431738 100644
--- a/ctdb/ib/ibwrapper_test.c
+++ b/ctdb/ib/ibwrapper_test.c
@@ -106,7 +106,7 @@ int ibwtest_send_id(struct ibw_conn *conn)
DEBUG(DEBUG_DEBUG, ("ibwtest_send_id\n"));
len = sizeof(uint32_t)+strlen(tcx->id)+2;
if (ibw_alloc_send_buf(conn, (void **)&buf, &key, len)) {
- DEBUG(0, ("send_id: ibw_alloc_send_buf failed\n"));
+ DEBUG(DEBUG_ERR, ("send_id: ibw_alloc_send_buf failed\n"));
return -1;
}
@@ -116,7 +116,7 @@ int ibwtest_send_id(struct ibw_conn *conn)
strcpy(buf+sizeof(uint32_t)+1, tcx->id);
if (ibw_send(conn, buf, key, len)) {
- DEBUG(0, ("send_id: ibw_send error\n"));
+ DEBUG(DEBUG_ERR, ("send_id: ibw_send error\n"));
return -1;
}
tcx->nsent++;
@@ -147,7 +147,7 @@ int ibwtest_send_test_msg(struct ibwtest_ctx *tcx, struct ibw_conn *conn, const
strcpy(p, msg);
if (ibw_send(conn, buf, key, len)) {
- DEBUG(0, ("send_test_msg: ibw_send error\n"));
+ DEBUG(DEBUG_ERR, ("send_test_msg: ibw_send error\n"));
return -1;
}
tcx->nsent++;
@@ -190,7 +190,7 @@ int ibwtest_do_varsize_scenario_conn_size(struct ibwtest_ctx *tcx, struct ibw_co
len = sizeof(uint32_t) + 1 + size + 1;
if (ibw_alloc_send_buf(conn, (void **)&buf, &key, len)) {
- DEBUG(0, ("varsize/ibw_alloc_send_buf failed\n"));
+ DEBUG(DEBUG_ERR, ("varsize/ibw_alloc_send_buf failed\n"));
return -1;
}
*((uint32_t *)buf) = len;
@@ -198,7 +198,7 @@ int ibwtest_do_varsize_scenario_conn_size(struct ibwtest_ctx *tcx, struct ibw_co
sum = ibwtest_fill_random(buf + sizeof(uint32_t) + 1, size);
buf[sizeof(uint32_t) + 1 + size] = sum;
if (ibw_send(conn, buf, key, len)) {
- DEBUG(0, ("varsize/ibw_send failed\n"));
+ DEBUG(DEBUG_ERR, ("varsize/ibw_send failed\n"));
return -1;
}
tcx->nsent++;
@@ -254,7 +254,7 @@ int ibwtest_connstate_handler(struct ibw_ctx *ctx, struct ibw_conn *conn)
DEBUG(DEBUG_DEBUG, ("test IBWS_CONNECT_REQUEST\n"));
tconn = talloc_zero(conn, struct ibwtest_conn);
if (ibw_accept(ctx, conn, tconn)) {
- DEBUG(0, ("error accepting the connect request\n"));
+ DEBUG(DEBUG_ERR, ("error accepting the connect request\n"));
}
break;
case IBWS_STOPPED:
@@ -279,7 +279,7 @@ int ibwtest_connstate_handler(struct ibw_ctx *ctx, struct ibw_conn *conn)
break;
case IBWC_CONNECTED:
if (gettimeofday(&tcx->start_time, NULL)) {
- DEBUG(0, ("gettimeofday error %d", errno));
+ DEBUG(DEBUG_ERR, ("gettimeofday error %d", errno));
return -1;
}
ibwtest_send_id(conn);
@@ -330,7 +330,7 @@ int ibwtest_receive_handler(struct ibw_conn *conn, void *buf, int n)
(uint32_t)sum,
tconn->id ? tconn->id : "NULL"));
if (sum!=((unsigned char *)buf)[n-1]) {
- DEBUG(0, ("ERROR: checksum mismatch %u!=%u\n",
+ DEBUG(DEBUG_ERR, ("ERROR: checksum mismatch %u!=%u\n",
(uint32_t)sum, (uint32_t)((unsigned char *)buf)[n-1]));
ibw_stop(tcx->ibwctx);
goto error;
@@ -404,7 +404,7 @@ static struct ibwtest_ctx *testctx = NULL;
void ibwtest_sigint_handler(int sig)
{
- DEBUG(0, ("got SIGINT\n"));
+ DEBUG(DEBUG_ERR, ("got SIGINT\n"));
if (testctx) {
if (testctx->ibwctx->state==IBWS_READY ||
testctx->ibwctx->state==IBWS_CONNECT_REQUEST ||
@@ -470,7 +470,7 @@ static int ibwtest_get_address(const char *address, struct in_addr *addr)
if (inet_pton(AF_INET, address, addr) <= 0) {
struct hostent *he = gethostbyname(address);
if (he == NULL || he->h_length > sizeof(*addr)) {
- DEBUG(0, ("invalid nework address '%s'\n", address));
+ DEBUG(DEBUG_ERR, ("invalid nework address '%s'\n", address));
return -1;
}
memcpy(addr, he->h_addr, he->h_length);
@@ -511,12 +511,12 @@ int ibwtest_init_server(struct ibwtest_ctx *tcx)
}
if (ibw_bind(tcx->ibwctx, &tcx->addrs[0])) {
- DEBUG(0, ("ERROR: ibw_bind failed\n"));
+ DEBUG(DEBUG_ERR, ("ERROR: ibw_bind failed\n"));
return -1;
}
if (ibw_listen(tcx->ibwctx, 1)) {
- DEBUG(0, ("ERROR: ibw_listen failed\n"));
+ DEBUG(DEBUG_ERR, ("ERROR: ibw_listen failed\n"));
return -1;
}
@@ -637,7 +637,7 @@ int main(int argc, char *argv[])
if (!tcx->is_server && tcx->nsent!=0 && !tcx->error) {
if (gettimeofday(&tcx->end_time, NULL)) {
- DEBUG(0, ("gettimeofday error %d\n", errno));
+ DEBUG(DEBUG_ERR, ("gettimeofday error %d\n", errno));
goto cleanup;
}
usec = (tcx->end_time.tv_sec - tcx->start_time.tv_sec) * 1000000 +
@@ -654,6 +654,6 @@ cleanup:
talloc_free(tcx);
if (ev)
talloc_free(ev);
- DEBUG(0, ("exited with code %d\n", result));
+ DEBUG(DEBUG_ERR, ("exited with code %d\n", result));
return result;
}