]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/async: reduce additional ceph_msg_header copy. 25938/head
authorJianpeng Ma <jianpeng.ma@intel.com>
Mon, 14 Jan 2019 03:02:34 +0000 (11:02 +0800)
committerJianpeng Ma <jianpeng.ma@intel.com>
Mon, 14 Jan 2019 03:02:34 +0000 (11:02 +0800)
Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
src/msg/async/ProtocolV1.cc
src/msg/async/ProtocolV2.cc

index 46bd405fc8d052f2f849676b6d00ad7d476001fd..f2bd5e94d838a7875b0e54a46ce5f40c3574ed59 100644 (file)
@@ -626,22 +626,21 @@ CtPtr ProtocolV1::handle_message_header(char *buffer, int r) {
 
   ldout(cct, 20) << __func__ << " got MSG header" << dendl;
 
-  ceph_msg_header header;
-  header = *((ceph_msg_header *)buffer);
+  current_header = *((ceph_msg_header *)buffer);
 
-  ldout(cct, 20) << __func__ << " got envelope type=" << header.type << " src "
-                 << entity_name_t(header.src) << " front=" << header.front_len
-                 << " data=" << header.data_len << " off " << header.data_off
+  ldout(cct, 20) << __func__ << " got envelope type=" << current_header.type << " src "
+                 << entity_name_t(current_header.src) << " front=" << current_header.front_len
+                 << " data=" << current_header.data_len << " off " << current_header.data_off
                  << dendl;
 
   if (messenger->crcflags & MSG_CRC_HEADER) {
     __u32 header_crc = 0;
-    header_crc = ceph_crc32c(0, (unsigned char *)&header,
-                             sizeof(header) - sizeof(header.crc));
+    header_crc = ceph_crc32c(0, (unsigned char *)&current_header,
+                             sizeof(current_header) - sizeof(current_header.crc));
     // verify header crc
-    if (header_crc != header.crc) {
+    if (header_crc != current_header.crc) {
       ldout(cct, 0) << __func__ << " got bad header crc " << header_crc
-                    << " != " << header.crc << dendl;
+                    << " != " << current_header.crc << dendl;
       return _fault();
     }
   }
@@ -651,7 +650,6 @@ CtPtr ProtocolV1::handle_message_header(char *buffer, int r) {
   front.clear();
   middle.clear();
   data.clear();
-  current_header = header;
 
   state = THROTTLE_MESSAGE;
   return CONTINUE(throttle_message);
index d52a10d9fbd1f78b48b5707c69cf97900321229f..1ea6e0b0a2d2cedee1ae0cc9c88111b92290047b 100644 (file)
@@ -623,22 +623,21 @@ CtPtr ProtocolV2::handle_message_header(char *buffer, int r) {
 
   ldout(cct, 20) << __func__ << " got MSG header" << dendl;
 
-  ceph_msg_header header;
-  header = *((ceph_msg_header *)buffer);
+  current_header = *((ceph_msg_header *)buffer);
 
-  ldout(cct, 20) << __func__ << " got envelope type=" << header.type << " src "
-                 << entity_name_t(header.src) << " front=" << header.front_len
-                 << " data=" << header.data_len << " off " << header.data_off
+  ldout(cct, 20) << __func__ << " got envelope type=" << current_header.type << " src "
+                 << entity_name_t(current_header.src) << " front=" << current_header.front_len
+                 << " data=" << current_header.data_len << " off " << current_header.data_off
                  << dendl;
 
   if (messenger->crcflags & MSG_CRC_HEADER) {
     __u32 header_crc = 0;
-    header_crc = ceph_crc32c(0, (unsigned char *)&header,
-                             sizeof(header) - sizeof(header.crc));
+    header_crc = ceph_crc32c(0, (unsigned char *)&current_header,
+                             sizeof(current_header) - sizeof(current_header.crc));
     // verify header crc
-    if (header_crc != header.crc) {
+    if (header_crc != current_header.crc) {
       ldout(cct, 0) << __func__ << " got bad header crc " << header_crc
-                    << " != " << header.crc << dendl;
+                    << " != " << current_header.crc << dendl;
       return _fault();
     }
   }
@@ -648,7 +647,6 @@ CtPtr ProtocolV2::handle_message_header(char *buffer, int r) {
   front.clear();
   middle.clear();
   data.clear();
-  current_header = header;
 
   state = THROTTLE_MESSAGE;
   return CONTINUE(throttle_message);