]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: use global compressor if possible 10970/head
authorxie xingguo <xie.xingguo@zte.com.cn>
Sat, 3 Sep 2016 09:51:19 +0000 (17:51 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Mon, 5 Sep 2016 12:30:56 +0000 (20:30 +0800)
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/os/bluestore/BlueStore.cc

index 565bf0b0a032532eac6c612fdff7351c7cd6bb30..90bb7650c3f97b0619d16d3558f35b4cab7e83cc 100644 (file)
@@ -3998,14 +3998,17 @@ int BlueStore::_decompress(bufferlist& source, bufferlist* result)
   bluestore_compression_header_t chdr;
   ::decode(chdr, i);
   string name = bluestore_blob_t::get_comp_alg_name(chdr.type);
-  CompressorRef compressor = Compressor::create(cct, name);
-  if (!compressor.get()) {
+  CompressorRef cp = compressor;
+  if (!cp || cp->get_type() != name)
+    cp = Compressor::create(cct, name);
+
+  if (!cp.get()) {
     // if compressor isn't available - error, because cannot return
     // decompressed data?
     derr << __func__ << " can't load decompressor " << chdr.type << dendl;
     r = -EIO;
   } else {
-    r = compressor->decompress(i, chdr.length, *result);
+    r = cp->decompress(i, chdr.length, *result);
     if (r < 0) {
       derr << __func__ << " decompression failed with exit code " << r << dendl;
       r = -EIO;