]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: stop calculating bound if we must reshard
authorxie xingguo <xie.xingguo@zte.com.cn>
Mon, 12 Jun 2017 12:28:52 +0000 (20:28 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Mon, 12 Jun 2017 12:28:52 +0000 (20:28 +0800)
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/os/bluestore/BlueStore.cc

index a974b5ac836fcac30ff713869d8e70cea1c1890f..33686fd9594ca42a3810fb965f998f77c0d7eb8c 100644 (file)
@@ -2306,8 +2306,6 @@ bool BlueStore::ExtentMap::encode_some(
 
   unsigned n = 0;
   size_t bound = 0;
-  denc(struct_v, bound);
-  denc_varint(0, bound);
   bool must_reshard = false;
   for (auto p = start;
        p != extent_map.end() && p->logical_offset < end;
@@ -2320,21 +2318,26 @@ bool BlueStore::ExtentMap::encode_some(
       request_reshard(p->blob_start(), p->blob_end());
       must_reshard = true;
     }
-    denc_varint(0, bound); // blobid
-    denc_varint(0, bound); // logical_offset
-    denc_varint(0, bound); // len
-    denc_varint(0, bound); // blob_offset
+    if (!must_reshard) {
+      denc_varint(0, bound); // blobid
+      denc_varint(0, bound); // logical_offset
+      denc_varint(0, bound); // len
+      denc_varint(0, bound); // blob_offset
 
-    p->blob->bound_encode(
-      bound,
-      struct_v,
-      p->blob->shared_blob->get_sbid(),
-      false);
+      p->blob->bound_encode(
+        bound,
+        struct_v,
+        p->blob->shared_blob->get_sbid(),
+        false);
+    }
   }
   if (must_reshard) {
     return true;
   }
 
+  denc(struct_v, bound);
+  denc_varint(0, bound); // number of extents
+
   {
     auto app = bl.get_contiguous_appender(bound);
     denc(struct_v, app);