]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: fix possible wrong initial shard during partial reshard
authorxie xingguo <xie.xingguo@zte.com.cn>
Tue, 13 Jun 2017 06:08:25 +0000 (14:08 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Tue, 13 Jun 2017 13:42:50 +0000 (21:42 +0800)
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/os/bluestore/BlueStore.cc

index e89986833920896c961c6d4e1bbdc1c5cbfad872..b0c2e223272f0174fb4353bf7d1eda7462250432 100644 (file)
@@ -2095,7 +2095,7 @@ void BlueStore::ExtentMap::reshard(
 
   // reshard
   unsigned estimate = 0;
-  unsigned offset = 0;
+  unsigned offset = needs_reshard_begin;
   vector<bluestore_onode_t::shard_info> new_shard_info;
   unsigned max_blob_end = 0;
   Extent dummy(needs_reshard_begin);
@@ -2112,11 +2112,11 @@ void BlueStore::ExtentMap::reshard(
     if (estimate &&
        estimate + extent_avg > target + (would_span ? slop : 0)) {
       // new shard
-      if (offset == 0) {
+      if (offset == needs_reshard_begin) {
        new_shard_info.emplace_back(bluestore_onode_t::shard_info());
        new_shard_info.back().offset = offset;
        dout(20) << __func__ << "  new shard 0x" << std::hex << offset
-                << std::dec << dendl;
+                 << std::dec << dendl;
       }
       offset = e->logical_offset;
       new_shard_info.emplace_back(bluestore_onode_t::shard_info());
@@ -2126,9 +2126,9 @@ void BlueStore::ExtentMap::reshard(
       estimate = 0;
     }
     estimate += extent_avg;
-    unsigned bb = e->blob_start();
-    if (bb < spanning_scan_begin) {
-      spanning_scan_begin = bb;
+    unsigned bs = e->blob_start();
+    if (bs < spanning_scan_begin) {
+      spanning_scan_begin = bs;
     }
     uint32_t be = e->blob_end();
     if (be > max_blob_end) {