]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
xio: avoid hardcoded 216 for max accelio header len
authorAvner BenHanoch <avnerb@mellanox.com>
Mon, 11 Apr 2016 11:48:46 +0000 (14:48 +0300)
committerAvner BenHanoch <avnerb@mellanox.com>
Sun, 1 May 2016 09:56:11 +0000 (12:56 +0300)
create new static method that knows to calculate this value at runtime.
(This will serve my coming commit that is going to change header fields and header size)

Signed-off-by: Avner BenHanoch <avnerb@mellanox.com>
src/msg/xio/XioMessenger.cc
src/msg/xio/XioMsg.cc
src/msg/xio/XioMsg.h

index 8927cb2e570da51e44799620601979763ba14e90..31ce6fe6a32a3556d746edcd09a267e00cc4a285 100644 (file)
@@ -293,7 +293,9 @@ void XioInit::package_init(CephContext *cct) {
        xopt = max(cct->_conf->xio_max_send_inline, 512);
        xio_set_opt(NULL, XIO_OPTLEVEL_ACCELIO, XIO_OPTNAME_MAX_INLINE_XIO_DATA,
                   &xopt, sizeof(xopt));
-       xopt = 216;
+
+       xopt = XioMsgHdr::get_max_encoded_length();
+       ldout(cct,2) << "setting accelio max header size " << xopt << dendl;
        xio_set_opt(NULL, XIO_OPTLEVEL_ACCELIO, XIO_OPTNAME_MAX_INLINE_XIO_HEADER,
                   &xopt, sizeof(xopt));
 
index ac32840ee57707ddc622098c73c2b78b0f33e7d2..76c6392a89ece5d38a5d10ea05713b09a5a147ea 100644 (file)
@@ -34,3 +34,12 @@ int XioDispatchHook::release_msgs()
   assert(r);
   return r;
 }
+
+/*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);
+  const std::list<buffer::ptr>& hdr_buffers = hdr.get_bl().buffers();
+  assert(hdr_buffers.size() == 1); /* accelio header is small without scatter gather */
+  return hdr_buffers.begin()->length();
+}
index 0cba48a0d73ba3d9a0241a02648674839399d542..10a26511b3f2219ee82b7f898fc86008ffd96786 100644 (file)
@@ -64,6 +64,8 @@ public:
       decode(bl_iter);
     }
 
+  static size_t get_max_encoded_length();
+
   const buffer::list& get_bl() { encode(bl); return bl; };
 
   inline void encode_hdr(buffer::list& bl) const {