]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
os/bluestore: make csum_type checking more efficient
authorxie xingguo <xie.xingguo@zte.com.cn>
Mon, 18 Jul 2016 03:31:43 +0000 (11:31 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Mon, 18 Jul 2016 03:31:43 +0000 (11:31 +0800)
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/os/bluestore/BlueStore.cc

index cc91d89af6f2ac9ec476038991a965a90bf33ca4..8f1548a7c9762b48198a1f773e59924b8660ef8d 100644 (file)
@@ -1478,12 +1478,14 @@ void BlueStore::_set_compression()
 
 void BlueStore::_set_csum()
 {
-  int t = bluestore_blob_t::get_csum_string_type(
-    g_conf->bluestore_csum_type);
-  if (t < 0 || !g_conf->bluestore_csum) {
-    t = bluestore_blob_t::CSUM_NONE;
+  csum_type = bluestore_blob_t::CSUM_NONE;
+  if (g_conf->bluestore_csum) {
+    int t = bluestore_blob_t::get_csum_string_type(
+            g_conf->bluestore_csum_type);
+    if (t > bluestore_blob_t::CSUM_NONE)
+      csum_type = t;
   }
-  csum_type = t;
+
   dout(10) << __func__ << " csum_type "
           << bluestore_blob_t::get_csum_type_string(csum_type)
           << dendl;