From: Vu Pham Date: Fri, 29 May 2015 17:32:22 +0000 (-0700) Subject: xio: sync to work with accellio v1.4 X-Git-Tag: v9.0.3~131^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ec2afbb5125f586ca1d0bf4e24c14eba76fe97cc;p=ceph.git xio: sync to work with accellio v1.4 latest master's HEAD - tag v1-4 Signed-off-by: Vu Pham --- diff --git a/src/common/buffer.cc b/src/common/buffer.cc index f4642b83ea07..5124b8c50f42 100644 --- a/src/common/buffer.cc +++ b/src/common/buffer.cc @@ -557,8 +557,8 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER; class buffer::xio_mempool : public buffer::raw { public: - struct xio_mempool_obj *mp; - xio_mempool(struct xio_mempool_obj *_mp, unsigned l) : + struct xio_reg_mem *mp; + xio_mempool(struct xio_reg_mem *_mp, unsigned l) : raw((char*)mp->addr, l), mp(_mp) { } ~xio_mempool() {} @@ -567,7 +567,7 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER; } }; - struct xio_mempool_obj* get_xio_mp(const buffer::ptr& bp) + struct xio_reg_mem* get_xio_mp(const buffer::ptr& bp) { buffer::xio_mempool *mb = dynamic_cast(bp.get_raw()); if (mb) { diff --git a/src/include/buffer.h b/src/include/buffer.h index d7dbfe3f28bd..d75ebf0d3102 100644 --- a/src/include/buffer.h +++ b/src/include/buffer.h @@ -58,7 +58,7 @@ #endif #if defined(HAVE_XIO) -struct xio_mempool_obj; +struct xio_reg_mem; class XioDispatchHook; #endif @@ -514,7 +514,7 @@ public: }; #if defined(HAVE_XIO) -xio_mempool_obj* get_xio_mp(const buffer::ptr& bp); +xio_reg_mem* get_xio_mp(const buffer::ptr& bp); #endif typedef buffer::ptr bufferptr; diff --git a/src/messages/MDataPing.h b/src/messages/MDataPing.h index 16bf4d2fb5a6..f713dac7f766 100644 --- a/src/messages/MDataPing.h +++ b/src/messages/MDataPing.h @@ -23,10 +23,10 @@ extern "C" { #include "libxio.h" } #else -struct xio_mempool_obj {}; +struct xio_reg_mem {}; #endif /* HAVE_XIO */ -typedef void (*mdata_hook_func)(struct xio_mempool_obj *mp); +typedef void (*mdata_hook_func)(struct xio_reg_mem *mp); class MDataPing : public Message { @@ -38,7 +38,7 @@ class MDataPing : public Message { std::string tag; uint32_t counter; mdata_hook_func mdata_hook; - struct xio_mempool_obj mp; + struct xio_reg_mem mp; bool free_data; MDataPing() @@ -47,7 +47,7 @@ class MDataPing : public Message { free_data(false) {} - struct xio_mempool_obj *get_mp() + struct xio_reg_mem *get_mp() { return ∓ } diff --git a/src/msg/xio/XioConnection.cc b/src/msg/xio/XioConnection.cc index 74a0620f00f2..6a2ae2e1270b 100644 --- a/src/msg/xio/XioConnection.cc +++ b/src/msg/xio/XioConnection.cc @@ -187,7 +187,7 @@ int XioConnection::passive_setup() static inline XioDispatchHook* pool_alloc_xio_dispatch_hook( XioConnection *xcon, Message *m, XioInSeq& msg_seq) { - struct xio_mempool_obj mp_mem; + struct xio_reg_mem mp_mem; int e = xpool_alloc(xio_msgr_noreg_mpool, sizeof(XioDispatchHook), &mp_mem); if (!!e) diff --git a/src/msg/xio/XioMessenger.cc b/src/msg/xio/XioMessenger.cc index cd502cae255c..ad87af181298 100644 --- a/src/msg/xio/XioMessenger.cc +++ b/src/msg/xio/XioMessenger.cc @@ -313,10 +313,10 @@ XioMessenger::XioMessenger(CephContext *cct, entity_name_t name, /* and set threshold for buffer callouts */ xopt = 16384; - xio_set_opt(NULL, XIO_OPTLEVEL_ACCELIO, XIO_OPTNAME_MAX_INLINE_DATA, + xio_set_opt(NULL, XIO_OPTLEVEL_ACCELIO, XIO_OPTNAME_MAX_INLINE_XIO_DATA, &xopt, sizeof(xopt)); xopt = 216; - xio_set_opt(NULL, XIO_OPTLEVEL_ACCELIO, XIO_OPTNAME_MAX_INLINE_HEADER, + xio_set_opt(NULL, XIO_OPTLEVEL_ACCELIO, XIO_OPTNAME_MAX_INLINE_XIO_HEADER, &xopt, sizeof(xopt)); struct xio_mempool_config mempool_config = { @@ -341,22 +341,22 @@ XioMessenger::XioMessenger(CephContext *cct, entity_name_t name, xio_mempool_create(-1 /* nodeid */, XIO_MEMPOOL_FLAG_REGULAR_PAGES_ALLOC); - (void) xio_mempool_add_allocator(xio_msgr_noreg_mpool, 64, + (void) xio_mempool_add_slab(xio_msgr_noreg_mpool, 64, cct->_conf->xio_mp_min, cct->_conf->xio_mp_max_64, - XMSG_MEMPOOL_QUANTUM); - (void) xio_mempool_add_allocator(xio_msgr_noreg_mpool, 256, + XMSG_MEMPOOL_QUANTUM, 0); + (void) xio_mempool_add_slab(xio_msgr_noreg_mpool, 256, cct->_conf->xio_mp_min, cct->_conf->xio_mp_max_256, - XMSG_MEMPOOL_QUANTUM); - (void) xio_mempool_add_allocator(xio_msgr_noreg_mpool, 1024, + XMSG_MEMPOOL_QUANTUM, 0); + (void) xio_mempool_add_slab(xio_msgr_noreg_mpool, 1024, cct->_conf->xio_mp_min, cct->_conf->xio_mp_max_1k, - XMSG_MEMPOOL_QUANTUM); - (void) xio_mempool_add_allocator(xio_msgr_noreg_mpool, getpagesize(), + XMSG_MEMPOOL_QUANTUM, 0); + (void) xio_mempool_add_slab(xio_msgr_noreg_mpool, getpagesize(), cct->_conf->xio_mp_min, cct->_conf->xio_mp_max_page, - XMSG_MEMPOOL_QUANTUM); + XMSG_MEMPOOL_QUANTUM, 0); /* initialize ops singleton */ xio_msgr_ops.on_session_event = on_session_event; @@ -388,9 +388,9 @@ int XioMessenger::pool_hint(uint32_t dsize) { return 0; /* if dsize is already present, returns -EEXIST */ - return xio_mempool_add_allocator(xio_msgr_noreg_mpool, dsize, 0, + return xio_mempool_add_slab(xio_msgr_noreg_mpool, dsize, 0, cct->_conf->xio_mp_max_hint, - XMSG_MEMPOOL_QUANTUM); + XMSG_MEMPOOL_QUANTUM, 0); } void XioMessenger::learned_addr(const entity_addr_t &peer_addr_for_me) @@ -661,7 +661,7 @@ xio_place_buffers(buffer::list& bl, XioMsg *xmsg, struct xio_msg*& req, //break; default: { - struct xio_mempool_obj *mp = get_xio_mp(*pb); + struct xio_reg_mem *mp = get_xio_mp(*pb); iov->mr = (mp) ? mp->mr : NULL; } break; @@ -777,7 +777,7 @@ int XioMessenger::_send_message(Message *m, const entity_inst_t& dest) static inline XioMsg* pool_alloc_xio_msg(Message *m, XioConnection *xcon, int ex_cnt) { - struct xio_mempool_obj mp_mem; + struct xio_reg_mem mp_mem; int e = xpool_alloc(xio_msgr_noreg_mpool, sizeof(XioMsg), &mp_mem); if (!!e) return NULL; @@ -1073,7 +1073,7 @@ void XioMessenger::mark_down_all() static inline XioMarkDownHook* pool_alloc_markdown_hook( XioConnection *xcon, Message *m) { - struct xio_mempool_obj mp_mem; + struct xio_reg_mem mp_mem; int e = xio_mempool_alloc(xio_msgr_noreg_mpool, sizeof(XioMarkDownHook), &mp_mem); if (!!e) diff --git a/src/msg/xio/XioMsg.h b/src/msg/xio/XioMsg.h index 21bb62cc2a2e..68d8ebe05afd 100644 --- a/src/msg/xio/XioMsg.h +++ b/src/msg/xio/XioMsg.h @@ -183,11 +183,11 @@ public: XioMsgHdr hdr; xio_msg_ex req_0; xio_msg_ex* req_arr; - struct xio_mempool_obj mp_this; + struct xio_reg_mem mp_this; atomic_t nrefs; public: - XioMsg(Message *_m, XioConnection *_xcon, struct xio_mempool_obj& _mp, + XioMsg(Message *_m, XioConnection *_xcon, struct xio_reg_mem& _mp, int _ex_cnt) : XioSubmit(XioSubmit::OUTGOING_MSG, _xcon), m(_m), hdr(m->get_header(), m->get_footer()), @@ -215,7 +215,7 @@ public: void put(int n) { int refs = nrefs.sub(n); if (refs == 0) { - struct xio_mempool_obj *mp = &this->mp_this; + struct xio_reg_mem *mp = &this->mp_this; this->~XioMsg(); xpool_free(sizeof(XioMsg), mp); } @@ -281,10 +281,10 @@ private: friend class XioConnection; friend class XioMessenger; public: - struct xio_mempool_obj mp_this; + struct xio_reg_mem mp_this; XioDispatchHook(XioConnection *_xcon, Message *_m, XioInSeq& _msg_seq, - struct xio_mempool_obj& _mp) : + struct xio_reg_mem& _mp) : CompletionHook(_m), xcon(_xcon->get()), msg_seq(_msg_seq), @@ -319,7 +319,7 @@ public: */ if (!cl_flag && release_msgs()) return; - struct xio_mempool_obj *mp = &this->mp_this; + struct xio_reg_mem *mp = &this->mp_this; this->~XioDispatchHook(); xpool_free(sizeof(XioDispatchHook), mp); } @@ -351,10 +351,10 @@ private: XioConnection* xcon; public: - struct xio_mempool_obj mp_this; + struct xio_reg_mem mp_this; XioMarkDownHook( - XioConnection* _xcon, Message *_m, struct xio_mempool_obj& _mp) : + XioConnection* _xcon, Message *_m, struct xio_reg_mem& _mp) : CompletionHook(_m), xcon(_xcon->get()), mp_this(_mp) { } @@ -362,7 +362,7 @@ public: virtual void finish(int r) { xcon->put(); - struct xio_mempool_obj *mp = &this->mp_this; + struct xio_reg_mem *mp = &this->mp_this; this->~XioMarkDownHook(); xio_mempool_free(mp); } diff --git a/src/msg/xio/XioPool.h b/src/msg/xio/XioPool.h index 2df24b07195a..cd74803eae08 100644 --- a/src/msg/xio/XioPool.h +++ b/src/msg/xio/XioPool.h @@ -26,8 +26,8 @@ extern "C" { static inline int xpool_alloc(struct xio_mempool *pool, uint64_t size, - struct xio_mempool_obj* mp); -static inline void xpool_free(uint64_t size, struct xio_mempool_obj* mp); + struct xio_reg_mem* mp); +static inline void xpool_free(uint64_t size, struct xio_reg_mem* mp); using ceph::atomic_t; @@ -42,7 +42,7 @@ public: static const int MB = 8; struct xio_piece { - struct xio_mempool_obj mp[1]; + struct xio_reg_mem mp[1]; struct xio_piece *next; int s; char payload[MB]; @@ -66,7 +66,7 @@ public: void *alloc(size_t _s) { void *r; - struct xio_mempool_obj mp[1]; + struct xio_reg_mem mp[1]; struct xio_piece *x; int e = xpool_alloc(handle, (sizeof(struct xio_piece)-MB) + _s, mp); if (e) { @@ -197,7 +197,7 @@ public: extern XioPoolStats xp_stats; static inline int xpool_alloc(struct xio_mempool *pool, uint64_t size, - struct xio_mempool_obj* mp) + struct xio_reg_mem* mp) { // try to allocate from the xio pool int r = xio_mempool_alloc(pool, size, mp); @@ -215,7 +215,7 @@ static inline int xpool_alloc(struct xio_mempool *pool, uint64_t size, return 0; } -static inline void xpool_free(uint64_t size, struct xio_mempool_obj* mp) +static inline void xpool_free(uint64_t size, struct xio_reg_mem* mp) { if (mp->length) { if (unlikely(XioPool::trace_mempool)) diff --git a/src/test/messenger/message_helper.h b/src/test/messenger/message_helper.h index cac19445dd5d..769c9b4a4187 100644 --- a/src/test/messenger/message_helper.h +++ b/src/test/messenger/message_helper.h @@ -47,7 +47,7 @@ static inline Message* new_ping_monstyle(const char *tag, int mult) #if defined(HAVE_XIO) extern struct xio_mempool *xio_msgr_mpool; -void xio_hook_func(struct xio_mempool_obj *mp) +void xio_hook_func(struct xio_reg_mem *mp) { xio_mempool_free(mp); } @@ -63,7 +63,7 @@ static inline Message* new_ping_with_data(const char *tag, uint32_t size) bufferlist bl; void *p; - struct xio_mempool_obj *mp = m->get_mp(); + struct xio_reg_mem *mp = m->get_mp(); int e = xio_mempool_alloc(xio_msgr_mpool, size, mp); assert(e == 0); p = mp->addr;