]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: dedup if space overlap truly exists
authorxie xingguo <xie.xingguo@zte.com.cn>
Tue, 15 Nov 2016 05:59:56 +0000 (13:59 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Tue, 15 Nov 2016 05:59:56 +0000 (13:59 +0800)
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/os/bluestore/BlueStore.cc

index 76fe88a4d0c53377ca63af53aa4b198267b90e0d..b56201f078b1a9d7dc184ee821c389dc83092d94 100644 (file)
@@ -6616,22 +6616,24 @@ void BlueStore::_txc_finalize_kv(TransContext *txc, KeyValueDB::Transaction t)
   // same region in this transaction.  The freelist doesn't like that.
   // (Actually, the only thing that cares is the BitmapFreelistManager
   // debug check. But that's important.)
-  interval_set<uint64_t> overlap;
   interval_set<uint64_t> tmp_allocated, tmp_released;
   interval_set<uint64_t> *pallocated = &txc->allocated;
   interval_set<uint64_t> *preleased = &txc->released;
   if (!txc->allocated.empty() && !txc->released.empty()) {
+    interval_set<uint64_t> overlap;
     overlap.intersection_of(txc->allocated, txc->released);
-    tmp_allocated = txc->allocated;
-    tmp_allocated.subtract(overlap);
-    tmp_released = txc->released;
-    tmp_released.subtract(overlap);
-    dout(20) << __func__ << "  overlap 0x" << std::hex << overlap
-            << ", new allocated 0x" << tmp_allocated
-            << " released 0x" << tmp_released << std::dec
-            << dendl;
-    pallocated = &tmp_allocated;
-    preleased = &tmp_released;
+    if (!overlap.empty()) {
+      tmp_allocated = txc->allocated;
+      tmp_allocated.subtract(overlap);
+      tmp_released = txc->released;
+      tmp_released.subtract(overlap);
+      dout(20) << __func__ << "  overlap 0x" << std::hex << overlap
+              << ", new allocated 0x" << tmp_allocated
+              << " released 0x" << tmp_released << std::dec
+              << dendl;
+      pallocated = &tmp_allocated;
+      preleased = &tmp_released;
+    }
   }
 
   // update freelist with non-overlap sets