]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: Do not copy a string just to find its length
authorAdam C. Emerson <aemerson@redhat.com>
Mon, 20 Nov 2017 21:13:01 +0000 (16:13 -0500)
committerAdam C. Emerson <aemerson@redhat.com>
Thu, 7 Dec 2017 20:46:11 +0000 (15:46 -0500)
I really dislike whoever decided to disallow taking the address of
member functions in the standard library.

Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
src/os/bluestore/BlueStore.cc

index d184dfa85d038cfb1fea68e4e6e66222255bc1f1..04cdedb95733603a40dd5e8f446aeb73c027239c 100644 (file)
@@ -4727,8 +4727,11 @@ int BlueStore::_open_db(bool create, bool to_repair_db)
       env->CreateDir(fn);
       if (cct->_conf->rocksdb_separate_wal_dir)
        env->CreateDir(fn + ".wal");
-      if (cct->_conf->get_val<std::string>("rocksdb_db_paths").length())
-       env->CreateDir(fn + ".slow");
+
+      if (cct->_conf->with_val<std::string>(
+            "rocksdb_db_paths", [](const std::string& s) {
+              return s.length(); }))
+        env->CreateDir(fn + ".slow");
     }
   } else if (create) {
     int r = ::mkdir(fn.c_str(), 0755);