From 4561a0f16221d43e94a4bceb2cb4c2d73833164b Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Tue, 16 Mar 2021 09:13:00 +0800 Subject: [PATCH] os/bluestore: move BlueRocksEnv::split() to .cc this helper is only used by the functions in the .cc file, and it does not reference BlueRocksEnv member variable or methods. so move it to an anonymous namespace. Signed-off-by: Kefu Chai (cherry picked from commit c1c90582dbe9274c5004f65d817cc83ef1b3062d) --- src/os/bluestore/BlueRocksEnv.cc | 13 +++++++++++++ src/os/bluestore/BlueRocksEnv.h | 8 -------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/os/bluestore/BlueRocksEnv.cc b/src/os/bluestore/BlueRocksEnv.cc index 60593ec8214e7..b3dd73a744282 100644 --- a/src/os/bluestore/BlueRocksEnv.cc +++ b/src/os/bluestore/BlueRocksEnv.cc @@ -7,6 +7,8 @@ #include "kv/RocksDBStore.h" #include "string.h" +namespace { + rocksdb::Status err_to_status(int r) { switch (r) { @@ -28,6 +30,17 @@ rocksdb::Status err_to_status(int r) } } +void split(const std::string &fn, std::string *dir, std::string *file) +{ + size_t slash = fn.rfind('/'); + *file = fn.substr(slash + 1); + while (slash && fn[slash-1] == '/') + --slash; + *dir = fn.substr(0, slash); +} + +} + // A file abstraction for reading sequentially through a file class BlueRocksSequentialFile : public rocksdb::SequentialFile { BlueFS *fs; diff --git a/src/os/bluestore/BlueRocksEnv.h b/src/os/bluestore/BlueRocksEnv.h index 82cffcd809bdd..62bcddcf67626 100644 --- a/src/os/bluestore/BlueRocksEnv.h +++ b/src/os/bluestore/BlueRocksEnv.h @@ -16,14 +16,6 @@ class BlueFS; class BlueRocksEnv : public rocksdb::EnvWrapper { - void split(const std::string &fn, std::string *dir, std::string *file) { - size_t slash = fn.rfind('/'); - *file = fn.substr(slash + 1); - while (slash && fn[slash-1] == '/') - --slash; - *dir = fn.substr(0, slash); - } - public: // Create a brand new sequentially-readable file with the specified name. // On success, stores a pointer to the new file in *result and returns OK. -- 2.39.5