From 3e1ac445a90e2c9a1486f0e02a8238f44f1de3e4 Mon Sep 17 00:00:00 2001 From: Matt Benjamin Date: Fri, 10 Jun 2016 15:44:29 -0400 Subject: [PATCH] xio: fix build (entity_addr_t encoding) Currently XioMessenger encodes an entity_addr_t in its wire header. The new 'features' argument to entity_addr_t::encode should have the actual XioMessenger::local_features value when actually encoding (and some value otherwise). Signed-off-by: Matt Benjamin --- src/msg/xio/XioMessenger.cc | 4 +++- src/msg/xio/XioMsg.cc | 2 +- src/msg/xio/XioMsg.h | 16 ++++++++++------ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/msg/xio/XioMessenger.cc b/src/msg/xio/XioMessenger.cc index 0f191161dbab4..bce31d3f9d55b 100644 --- a/src/msg/xio/XioMessenger.cc +++ b/src/msg/xio/XioMessenger.cc @@ -775,7 +775,9 @@ static inline XioMsg* pool_alloc_xio_msg(Message *m, XioConnection *xcon, return NULL; XioMsg *xmsg = reinterpret_cast(mp_mem.addr); assert(!!xmsg); - new (xmsg) XioMsg(m, xcon, mp_mem, ex_cnt); + new (xmsg) XioMsg(m, xcon, mp_mem, ex_cnt, + static_cast( + xcon->get_messenger())->local_features); return xmsg; } diff --git a/src/msg/xio/XioMsg.cc b/src/msg/xio/XioMsg.cc index ef0ab6f5a8b3b..cf7712d395080 100644 --- a/src/msg/xio/XioMsg.cc +++ b/src/msg/xio/XioMsg.cc @@ -38,7 +38,7 @@ int XioDispatchHook::release_msgs() /*static*/ size_t XioMsgHdr::get_max_encoded_length() { ceph_msg_header _ceph_msg_header; ceph_msg_footer _ceph_msg_footer; - XioMsgHdr hdr (_ceph_msg_header, _ceph_msg_footer); + XioMsgHdr hdr (_ceph_msg_header, _ceph_msg_footer, 0 /* features */); const std::list& hdr_buffers = hdr.get_bl().buffers(); assert(hdr_buffers.size() == 1); /* accelio header is small without scatter gather */ return hdr_buffers.begin()->length(); diff --git a/src/msg/xio/XioMsg.h b/src/msg/xio/XioMsg.h index eb9017b2cff25..73d210df2da01 100644 --- a/src/msg/xio/XioMsg.h +++ b/src/msg/xio/XioMsg.h @@ -28,6 +28,8 @@ extern "C" { namespace bi = boost::intrusive; +class XioMessenger; + class XioMsgCnt { public: @@ -51,10 +53,12 @@ public: entity_addr_t addr; /* XXX hack! */ ceph_msg_header* hdr; ceph_msg_footer* ftr; + uint64_t features; buffer::list bl; public: - XioMsgHdr(ceph_msg_header& _hdr, ceph_msg_footer& _ftr) - : tag(CEPH_MSGR_TAG_MSG), msg_cnt(0), hdr(&_hdr), ftr(&_ftr) + XioMsgHdr(ceph_msg_header& _hdr, ceph_msg_footer& _ftr, uint64_t _features) + : tag(CEPH_MSGR_TAG_MSG), msg_cnt(0), hdr(&_hdr), ftr(&_ftr), + features(_features) { } XioMsgHdr(ceph_msg_header& _hdr, ceph_msg_footer &_ftr, buffer::ptr p) @@ -69,11 +73,11 @@ public: const buffer::list& get_bl() { encode(bl); return bl; }; - inline void encode_hdr(buffer::list& bl) const { + inline void encode_hdr(ceph::buffer::list& bl) const { ::encode(tag, bl); ::encode(msg_cnt, bl); ::encode(peer_type, bl); - ::encode(addr, bl); + ::encode(addr, bl, features); ::encode(hdr->seq, bl); ::encode(hdr->tid, bl); ::encode(hdr->type, bl); @@ -248,9 +252,9 @@ public: public: XioMsg(Message *_m, XioConnection *_xcon, struct xio_reg_mem& _mp, - int _ex_cnt) : + int _ex_cnt, uint64_t _features) : XioSend(_xcon, _mp, _ex_cnt), - m(_m), hdr(m->get_header(), m->get_footer()), + m(_m), hdr(m->get_header(), m->get_footer(), _features), req_arr(NULL) { const entity_inst_t &inst = xcon->get_messenger()->get_myinst(); -- 2.39.5