From 1c07f2e2e82e81c0bfeee4e7cc0d41d8e9cc1e7e Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Mon, 18 Jul 2016 11:31:43 +0800 Subject: [PATCH] os/bluestore: make csum_type checking more efficient Signed-off-by: xie xingguo --- src/os/bluestore/BlueStore.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index cc91d89af6f2..8f1548a7c976 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -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; -- 2.47.3