]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/Message: make {encode,decode}_trace unconditional
authorSage Weil <sage@redhat.com>
Fri, 7 Apr 2017 19:40:21 +0000 (15:40 -0400)
committerSage Weil <sage@redhat.com>
Fri, 5 May 2017 18:05:24 +0000 (14:05 -0400)
These are protocol features and cannot vary based on our compilation.
Encode and decode unconditionally.  The callers have already guarded these
field additions with a message version bump and are conditionally calling
decode_trace.

Signed-off-by: Sage Weil <sage@redhat.com>
src/msg/Message.cc

index 4edbff051b85b7cf8be10994451cf23eb10e8703..62cbcdd33cb93f3fa60fcb1f9bac35432bef3517 100644 (file)
@@ -846,26 +846,25 @@ WRITE_RAW_ENCODER(blkin_trace_info)
 
 void Message::encode_trace(bufferlist &bl, uint64_t features) const
 {
-#ifdef WITH_BLKIN
-  if (features & CEPH_FEATURE_BLKIN_TRACING)
-    ::encode(*trace.get_info(), bl);
-#endif
+  auto p = trace.get_info();
+  static const blkin_trace_info empty = { 0, 0, 0 };
+  if (!p) {
+    p = &empty;
+  }
+  ::encode(*p, bl);
 }
 
 void Message::decode_trace(bufferlist::iterator &p, bool create)
 {
+  blkin_trace_info info = {};
+  ::decode(info, p);
+
 #ifdef WITH_BLKIN
   if (!connection)
     return;
 
   const auto msgr = connection->get_messenger();
   const auto endpoint = msgr->get_trace_endpoint();
-  blkin_trace_info info = {};
-
-  // only decode a trace if both sides of the connection agree
-  if (connection->has_feature(CEPH_FEATURE_BLKIN_TRACING))
-    ::decode(info, p);
-
   if (info.trace_id) {
     trace.init(get_type_name(), endpoint, &info, true);
     trace.event("decoded trace");