From: Sage Weil Date: Wed, 11 May 2016 20:26:15 +0000 (-0400) Subject: os/bluestore: track csum config options X-Git-Tag: v11.0.0~359^2~109 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=736aad13a89ae0a163a213e75d791615372dae7d;p=ceph.git os/bluestore: track csum config options Use global csum_type member to drive new checksum calcuations. Signed-off-by: Sage Weil --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index b59d2411a738..1ece0c0445fa 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -770,7 +770,8 @@ BlueStore::BlueStore(CephContext *cct, const string& path) kv_sync_thread(this), kv_stop(false), logger(NULL), - checksummer(new Checksummer) + checksummer(new Checksummer), + csum_type(bluestore_blob_t::CSUM_CRC32C) { _init_logger(); } @@ -785,6 +786,32 @@ BlueStore::~BlueStore() delete checksummer; } +const char **BlueStore::get_tracked_conf_keys() const +{ + static const char* KEYS[] = { + "bluestore_csum", + "bluestore_csum_type", + NULL + }; + return KEYS; +} + +void BlueStore::handle_conf_change(const struct md_config_t *conf, + const std::set &changed) +{ + if (changed.count("bluestore_csum_type") || + changed.count("bluestore_csum")) { + csum_type = bluestore_blob_t::get_csum_string_type( + conf->bluestore_csum_type); + if (csum_type < 0 || !conf->bluestore_csum) { + csum_type = bluestore_blob_t::CSUM_NONE; + } + dout(10) << __func__ << " csum_type " + << bluestore_blob_t::get_csum_type_string(csum_type) + << dendl; + } +} + void BlueStore::_init_logger() { PerfCountersBuilder b(g_ceph_context, "BlueStore", diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index 5a827d4084ec..24368bdfda89 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -58,11 +58,17 @@ enum { l_bluestore_last }; -class BlueStore : public ObjectStore { +class BlueStore : public ObjectStore, + public md_config_obs_t { // ----------------------------------------------------- // types public: + // config observer + virtual const char** get_tracked_conf_keys() const override; + virtual void handle_conf_change(const struct md_config_t *conf, + const std::set &changed) override; + class TransContext; /// an in-memory extent-map, shared by a group of objects (w/ same hash value) @@ -586,6 +592,7 @@ private: list removed_collections; Checksummer *checksummer; + int csum_type; // -------------------------------------------------------- // private methods