]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: track csum config options
authorSage Weil <sage@redhat.com>
Wed, 11 May 2016 20:26:15 +0000 (16:26 -0400)
committerSage Weil <sage@redhat.com>
Wed, 1 Jun 2016 15:38:45 +0000 (11:38 -0400)
Use global csum_type member to drive new checksum calcuations.

Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h

index b59d2411a738b41c36408ae75426b61397c0e567..1ece0c0445fa810c8a43d902e4b8f561a3491292 100644 (file)
@@ -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<std::string> &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",
index 5a827d4084ecaa7c5d84bc404aa7bba5339ab0e7..24368bdfda896e652841153d3abca44e64e436b6 100644 (file)
@@ -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<std::string> &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<CollectionRef> removed_collections;
 
   Checksummer *checksummer;
+  int csum_type;
 
   // --------------------------------------------------------
   // private methods