From: Radoslaw Zarzynski Date: Wed, 21 Jul 2021 09:27:34 +0000 (+0000) Subject: os: rework the factory of ObjectStore. X-Git-Tag: v17.1.0~1314^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=007133a6acd1394d5b285dfdc7410547a5ed99d0;p=ceph.git os: rework the factory of ObjectStore. The goals here are: 1. make deprecation of `FileStore` easier as creational dependencies are segmented into a variant of `create()` that could be cut off altogether with `FileStore`. 2. Allow crimson adapt `create()` without burdening it with `FileStore`'s dependencies. 3. Simplify the implementation as a bunch of preprocessor directives accumulated there over the time. Signed-off-by: Radoslaw Zarzynski --- diff --git a/src/os/ObjectStore.cc b/src/os/ObjectStore.cc index 83288068199c..75deb19662ab 100644 --- a/src/os/ObjectStore.cc +++ b/src/os/ObjectStore.cc @@ -33,46 +33,39 @@ using std::string; std::unique_ptr ObjectStore::create( CephContext *cct, const string& type, - const string& data, - const string& journal, - osflagbits_t flags) + const string& data) { #ifndef WITH_SEASTAR - if (type == "filestore") { - return std::make_unique(cct, data, journal, flags); - } if (type == "memstore") { return std::make_unique(cct, data); } #endif #if defined(WITH_BLUESTORE) - if (type == "bluestore") { + if (type == "bluestore" || type == "random") { return std::make_unique(cct, data); } -#ifndef WITH_SEASTAR - if (type == "random") { - if (rand() % 2) { - return std::make_unique(cct, data, journal, flags); - } else { - return std::make_unique(cct, data); - } - } #endif -#else + return nullptr; +} + #ifndef WITH_SEASTAR - if (type == "random") { +std::unique_ptr ObjectStore::create( + CephContext *cct, + const string& type, + const string& data, + const string& journal, + osflagbits_t flags) +{ + if (type == "filestore" || (type == "random" && rand() % 2)) { return std::make_unique(cct, data, journal, flags); } -#endif -#endif -#ifndef WITH_SEASTAR if (type == "kstore" && cct->check_experimental_feature_enabled("kstore")) { return std::make_unique(cct, data); } -#endif - return NULL; + return create(cct, type, data); } +#endif int ObjectStore::probe_block_device_fsid( CephContext *cct, diff --git a/src/os/ObjectStore.h b/src/os/ObjectStore.h index 3b8d33706154..d934d092919a 100644 --- a/src/os/ObjectStore.h +++ b/src/os/ObjectStore.h @@ -78,12 +78,18 @@ public: * @param journal path (or other descriptor) for journal (optional) * @param flags which filestores should check if applicable */ +#ifndef WITH_SEASTAR static std::unique_ptr create( CephContext *cct, const std::string& type, const std::string& data, const std::string& journal, osflagbits_t flags = 0); +#endif + static std::unique_ptr create( + CephContext *cct, + const std::string& type, + const std::string& data); /** * probe a block device to learn the uuid of the owning OSD