From 6917b2e27bdab0128a1deb71a952c8d91b3b38bc Mon Sep 17 00:00:00 2001 From: Avner BenHanoch Date: Tue, 3 May 2016 15:44:08 +0300 Subject: [PATCH] xio: provide dout_prefix for XioConnection with: from>>to, peer-type, and conn/sess 1. this prefix will be added for any log message from XioConnection (2. hence, remove info that is now redundeant in few existing log messages) Signed-off-by: Avner BenHanoch --- src/msg/xio/XioConnection.cc | 18 ++++++++++++------ src/msg/xio/XioConnection.h | 1 + 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/msg/xio/XioConnection.cc b/src/msg/xio/XioConnection.cc index d75bc80fec95c..8ad5853a99855 100644 --- a/src/msg/xio/XioConnection.cc +++ b/src/msg/xio/XioConnection.cc @@ -77,6 +77,14 @@ void print_ceph_msg(CephContext *cct, const char *tag, Message *m) } } +#undef dout_prefix +#define dout_prefix conn_prefix(_dout) +ostream& XioConnection::conn_prefix(std::ostream *_dout) { + return *_dout << "-- " << get_messenger()->get_myinst().addr << " >> " << peer_addr + << " peer=" << peer.name.type_str() + << " conn=" << conn << " sess=" << session << " "; +} + XioConnection::XioConnection(XioMessenger *m, XioConnection::type _type, const entity_inst_t& _peer) : Connection(m->cct, m), @@ -136,8 +144,7 @@ XioConnection::XioConnection(XioMessenger *m, XioConnection::type _type, xio_set_opt(NULL, XIO_OPTLEVEL_ACCELIO, XIO_OPTNAME_RCV_QUEUE_DEPTH_BYTES, &bytes_opt, sizeof(bytes_opt)); - ldout(m->cct,4) << "Peer type: " << peer.name.type_str() << - " throttle_msgs: " << xopt << " throttle_bytes: " << bytes_opt << dendl; + ldout(m->cct,4) << "throttle_msgs: " << xopt << " throttle_bytes: " << bytes_opt << dendl; /* XXXX fake features, aieee! */ set_features(XIO_ALL_FEATURES); @@ -281,7 +288,6 @@ int XioConnection::handle_data_msg(struct xio_session *session, << " iov_base " << tmsg->in.header.iov_base << " iov_len " << (int) tmsg->in.header.iov_len << " nents " << tmsg->in.pdata_iov.nents - << " conn " << conn << " sess " << session << " sn " << tmsg->sn << dendl; assert(session == this->session); in_seq.set_count(msg_cnt.msg_cnt); @@ -561,7 +567,7 @@ int XioConnection::on_ow_msg_send_complete(struct xio_session *session, } /* trace ctr */ ldout(msgr->cct,11) << "on_msg_delivered xcon: " << xsend->xcon << - " session: " << session << " msg: " << req << " sn: " << req->sn << dendl; + " msg: " << req << " sn: " << req->sn << dendl; XioMsg *xmsg = dynamic_cast(xsend); if (xmsg) { @@ -578,8 +584,8 @@ int XioConnection::on_ow_msg_send_complete(struct xio_session *session, if ((send_ctr <= uint32_t(xio_qdepth_low_mark())) && (1 /* XXX memory <= memory low-water mark */)) { cstate.state_up_ready(XioConnection::CState::OP_FLAG_NONE); - ldout(msgr->cct,2) << "on_msg_delivered xcon: " << xsend->xcon << - " session: " << session << " up_ready from flow_controlled" << dendl; + ldout(msgr->cct,2) << "on_msg_delivered xcon: " << xsend->xcon + << " up_ready from flow_controlled" << dendl; } } diff --git a/src/msg/xio/XioConnection.h b/src/msg/xio/XioConnection.h index cdd5b2dd80c54..5cebbe6b47e1a 100644 --- a/src/msg/xio/XioConnection.h +++ b/src/msg/xio/XioConnection.h @@ -272,6 +272,7 @@ public: if (conn) xio_connection_destroy(conn); } + ostream& conn_prefix(std::ostream *_dout); bool is_connected() override { return connected.read(); } -- 2.39.5