]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
msg/async/frames_v2: make rx_segments_t global
authorIlya Dryomov <idryomov@gmail.com>
Thu, 30 Apr 2020 15:22:14 +0000 (17:22 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Fri, 12 Jun 2020 12:37:54 +0000 (14:37 +0200)
Use it in ProtocolV2.h and later in unit tests.

While at it, drop the unused len struct.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
src/crimson/net/ProtocolV2.cc
src/crimson/net/ProtocolV2.h
src/msg/async/ProtocolV2.cc
src/msg/async/ProtocolV2.h
src/msg/async/frames_v2.h

index 516a05ce6e4ad5915c0b9ee17943795012411086..3221d648b360b7f3c6432b65c71ed7d24f9ddd79 100644 (file)
@@ -1906,7 +1906,7 @@ seastar::future<> ProtocolV2::read_message(utime_t throttle_stamp)
 
     // we need to get the size before std::moving segments data
     const size_t cur_msg_size = get_current_msg_size();
-    auto msg_frame = MessageFrame::Decode(std::move(rx_segments_data));
+    auto msg_frame = MessageFrame::Decode(rx_segments_data);
     // XXX: paranoid copy just to avoid oops
     ceph_msg_header2 current_header = msg_frame.header();
 
index 53d27a3603f8daf558705506e2f7bdd134ebf099..bd9f1a425bc8681d48b7e7b58777cc4fbdd04491 100644 (file)
@@ -123,8 +123,7 @@ class ProtocolV2 final : public Protocol {
   ceph::crypto::onwire::rxtx_t session_stream_handlers;
   boost::container::static_vector<ceph::msgr::v2::segment_t,
                                  ceph::msgr::v2::MAX_NUM_SEGMENTS> rx_segments_desc;
-  boost::container::static_vector<ceph::bufferlist,
-                                 ceph::msgr::v2::MAX_NUM_SEGMENTS> rx_segments_data;
+  ceph::msgr::v2::segment_bls_t rx_segments_data;
 
   size_t get_current_msg_size() const;
   seastar::future<ceph::msgr::v2::Tag> read_main_preamble();
index fd594b55d86823dcc4a2f42738a944b6319567e7..cdb8b7205571a855b58568eb9f28b0aebdc11095 100644 (file)
@@ -1422,7 +1422,7 @@ CtPtr ProtocolV2::handle_message() {
 
   // we need to get the size before std::moving segments data
   const size_t cur_msg_size = get_current_msg_size();
-  auto msg_frame = MessageFrame::Decode(std::move(rx_segments_data));
+  auto msg_frame = MessageFrame::Decode(rx_segments_data);
 
   // XXX: paranoid copy just to avoid oops
   ceph_msg_header2 current_header = msg_frame.header();
index 578561abf322e47fad554b53be49d52808c7fa2b..29ad191cbb1a2b5edac1f2b17ae0f053b9936a22 100644 (file)
@@ -98,8 +98,7 @@ private:
 
   boost::container::static_vector<ceph::msgr::v2::segment_t,
                                  ceph::msgr::v2::MAX_NUM_SEGMENTS> rx_segments_desc;
-  boost::container::static_vector<ceph::bufferlist,
-                                 ceph::msgr::v2::MAX_NUM_SEGMENTS> rx_segments_data;
+  ceph::msgr::v2::segment_bls_t rx_segments_data;
   ceph::msgr::v2::Tag next_tag;
   utime_t backoff;  // backoff time
   utime_t recv_stamp;
index c9e5e0f0784b89da2a38fabc5b5b454b6a6ef491..0576ce9cf92e0f55fcfabb95d57810b8f894970d 100644 (file)
@@ -7,6 +7,8 @@
 #include <array>
 #include <utility>
 
+#include <boost/container/static_vector.hpp>
+
 /**
  * Protocol V2 Frame Structures
  * 
@@ -674,6 +676,9 @@ protected:
   using ControlFrame::ControlFrame;
 };
 
+using segment_bls_t =
+    boost::container::static_vector<bufferlist, MAX_NUM_SEGMENTS>;
+
 // This class is used for encoding/decoding header of the message frame.
 // Body is processed almost independently with the sole junction point
 // being the `extra_payload_len` passed to get_buffer().
@@ -683,12 +688,6 @@ struct MessageFrame : public Frame<MessageFrame,
                                    segment_t::DEFAULT_ALIGNMENT,
                                    segment_t::DEFAULT_ALIGNMENT,
                                    segment_t::PAGE_SIZE_ALIGNMENT> {
-  struct {
-    uint32_t front;
-    uint32_t middle;
-    uint32_t data;
-  } len;
-
   static const Tag tag = Tag::MESSAGE;
 
   static MessageFrame Encode(const ceph_msg_header2 &msg_header,
@@ -706,10 +705,7 @@ struct MessageFrame : public Frame<MessageFrame,
     return f;
   }
 
-  using rx_segments_t =
-    boost::container::static_vector<ceph::bufferlist,
-                                    ceph::msgr::v2::MAX_NUM_SEGMENTS>;
-  static MessageFrame Decode(rx_segments_t &&recv_segments) {
+  static MessageFrame Decode(segment_bls_t& recv_segments) {
     MessageFrame f;
     // transfer segments' bufferlists. If a MessageFrame contains less
     // SegmentsNumV segments, the missing ones will be seen as zeroed.