]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/async: bump up preamble block size to 32 bytes.
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Thu, 14 Feb 2019 19:25:55 +0000 (20:25 +0100)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Thu, 21 Feb 2019 20:58:36 +0000 (21:58 +0100)
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/msg/async/ProtocolV2.cc

index 59df602ab01ee83db28a7ab51d8fda0eac7ad210..028e8dfc8d49602e648f690f01a00b3b7ed5d93e 100644 (file)
@@ -123,8 +123,10 @@ using segment_t = ProtocolV2::segment_t;
 // V2 preamble consists of one or more preamble blocks depending on
 // the number of segments a particular frame needs. Each block holds
 // up to 2 segments and has its own CRC.
+//
+// XXX: currently the multi-segment facility is NOT implemented.
 struct preamble_block_t {
-  static constexpr std::size_t MAX_NUM_SEGMENTS = 2;
+  static constexpr std::size_t MAX_NUM_SEGMENTS = 4;
 
   // ProtocolV2::Tag. For multi-segmented frames the value is the same
   // between subsequent preamble blocks.
@@ -136,15 +138,16 @@ struct preamble_block_t {
   __u8 num_segments;
 
   std::array<ProtocolV2::segment_t, MAX_NUM_SEGMENTS> segments;
+  __u8 _reserved[4];
 
   // CRC16 for this single preamble block.
   __le16 crc;
 } __attribute__((packed));
-static_assert(sizeof(preamble_block_t) == CRYPTO_BLOCK_SIZE);
+static_assert(sizeof(preamble_block_t) % CRYPTO_BLOCK_SIZE == 0);
 static_assert(std::is_standard_layout<preamble_block_t>::value);
 
 
-static constexpr uint32_t FRAME_PREAMBLE_SIZE = CRYPTO_BLOCK_SIZE;
+static constexpr uint32_t FRAME_PREAMBLE_SIZE = sizeof(preamble_block_t);
 
 template <class T>
 struct Frame {
@@ -210,7 +213,9 @@ public:
   Frame() : preamble_filler(payload.append_hole(FRAME_PREAMBLE_SIZE)) {}
 
   ceph::bufferlist &get_buffer() {
-    fill_preamble({ segment_t{ payload.length() - FRAME_PREAMBLE_SIZE, 1} }, {});
+    fill_preamble({
+      segment_t{ payload.length() - FRAME_PREAMBLE_SIZE, 1 }
+    }, {});
     return payload;
   }