]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: reduce overhead when trying to unshard blobs 15502/head
authorxie xingguo <xie.xingguo@zte.com.cn>
Tue, 6 Jun 2017 02:38:57 +0000 (10:38 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Tue, 6 Jun 2017 05:36:58 +0000 (13:36 +0800)
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/os/bluestore/BlueStore.cc

index b6d5573adf8f2875a980da27ce0d52b51ede26f9..49f958208a5ac40335c5102819f8593fe7bbf322 100644 (file)
@@ -10209,26 +10209,27 @@ int BlueStore::_do_remove(
        }
       }
 
-      uint32_t b_start = OBJECT_MAX_SIZE;
-      uint32_t b_end = 0;
-      for (auto& e : h->extent_map.extent_map) {
-       const bluestore_blob_t& b = e.blob->get_blob();
-       SharedBlob *sb = e.blob->shared_blob.get();
-       if (b.is_shared() &&
-           std::find(unshared_blobs.begin(), unshared_blobs.end(),
-                     sb) != unshared_blobs.end()) {
-         dout(20) << __func__ << "  unsharing " << *e.blob << dendl;
-         bluestore_blob_t& blob = e.blob->dirty_blob();
-         blob.clear_flag(bluestore_blob_t::FLAG_SHARED);
-         if (e.logical_offset < b_start) {
-           b_start = e.logical_offset;
-         }
-         if (e.logical_end() > b_end) {
-           b_end = e.logical_end();
-         }
-       }
-      }
       if (!unshared_blobs.empty()) {
+        uint32_t b_start = OBJECT_MAX_SIZE;
+        uint32_t b_end = 0;
+        for (auto& e : h->extent_map.extent_map) {
+          const bluestore_blob_t& b = e.blob->get_blob();
+          SharedBlob *sb = e.blob->shared_blob.get();
+          if (b.is_shared() &&
+              std::find(unshared_blobs.begin(), unshared_blobs.end(),
+                        sb) != unshared_blobs.end()) {
+            dout(20) << __func__ << "  unsharing " << *e.blob << dendl;
+            bluestore_blob_t& blob = e.blob->dirty_blob();
+            blob.clear_flag(bluestore_blob_t::FLAG_SHARED);
+            if (e.logical_offset < b_start) {
+              b_start = e.logical_offset;
+            }
+            if (e.logical_end() > b_end) {
+              b_end = e.logical_end();
+            }
+          }
+        }
+
        h->extent_map.dirty_range(b_start, b_end);
        txc->write_onode(h);
       }