From 1430f36f672d035bb3a8743ad443ce5727c283fc Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Thu, 12 Oct 2017 14:41:47 -0600 Subject: [PATCH] Build: create a proper WITH_BLUESTORE option Using Bluestore is not the same thing as having libaio, especially on non-Linux platforms. Signed-off-by: Alan Somers --- CMakeLists.txt | 12 ++++++------ do_freebsd.sh | 1 + src/include/config-h.in.cmake | 3 +++ src/os/CMakeLists.txt | 6 +++--- src/os/ObjectStore.cc | 6 +++--- src/test/encoding/types.h | 2 +- src/test/objectstore/CMakeLists.txt | 4 ++-- src/test/objectstore/store_test.cc | 16 ++++++++-------- src/test/objectstore/store_test_fixture.cc | 4 ++-- src/tools/ceph_kvstore_tool.cc | 6 +++--- 10 files changed, 32 insertions(+), 28 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ff17a8f754f..5b5e6a46247c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -180,21 +180,21 @@ find_package(Backtrace) if(LINUX) find_package(udev REQUIRED) set(HAVE_UDEV ${UDEV_FOUND}) - - find_package(aio REQUIRED) - set(HAVE_LIBAIO ${AIO_FOUND}) - find_package(blkid REQUIRED) set(HAVE_BLKID ${BLKID_FOUND}) else() set(HAVE_UDEV OFF) message(STATUS "Not using udev") - set(HAVE_LIBAIO OFF) - message(STATUS "Not using AIO") set(HAVE_BLKID OFF) message(STATUS "Not using BLKID") endif(LINUX) +option(WITH_BLUESTORE "Bluestore OSD backend" ON) +if(${WITH_BLUESTORE}) + find_package(aio REQUIRED) + set(HAVE_LIBAIO ${AIO_FOUND}) +endif(${WITH_BLUESTORE}) + option(WITH_OPENLDAP "OPENLDAP is here" ON) if(${WITH_OPENLDAP}) find_package(OpenLdap REQUIRED) diff --git a/do_freebsd.sh b/do_freebsd.sh index 2cfa8fa6a7c7..fd8c5b450d58 100755 --- a/do_freebsd.sh +++ b/do_freebsd.sh @@ -23,6 +23,7 @@ rm -rf build && ./do_cmake.sh "$*" \ -D WITH_SYSTEM_BOOST=ON \ -D WITH_LTTNG=OFF \ -D WITH_BLKID=OFF \ + -D WITH_BLUESTORE=OFF \ -D WITH_FUSE=ON \ -D WITH_KRBD=OFF \ -D WITH_XFS=OFF \ diff --git a/src/include/config-h.in.cmake b/src/include/config-h.in.cmake index f97157a51232..ed0820880574 100644 --- a/src/include/config-h.in.cmake +++ b/src/include/config-h.in.cmake @@ -136,6 +136,9 @@ /* ibverbs experimental conditional compilation */ #cmakedefine HAVE_IBV_EXP +/* define if bluestore enabled */ +#cmakedefine WITH_BLUESTORE + /* define if embedded enabled */ #cmakedefine WITH_EMBEDDED diff --git a/src/os/CMakeLists.txt b/src/os/CMakeLists.txt index ad2940449ac2..131a467756e6 100644 --- a/src/os/CMakeLists.txt +++ b/src/os/CMakeLists.txt @@ -18,7 +18,7 @@ set(libos_srcs kstore/kstore_types.cc fs/FS.cc) -if(HAVE_LIBAIO) +if(WITH_BLUESTORE) list(APPEND libos_srcs bluestore/Allocator.cc bluestore/BitmapFreelistManager.cc @@ -35,7 +35,7 @@ if(HAVE_LIBAIO) bluestore/BitAllocator.cc bluestore/aio.cc ) -endif(HAVE_LIBAIO) +endif(WITH_BLUESTORE) if(WITH_FUSE) list(APPEND libos_srcs @@ -112,7 +112,7 @@ add_dependencies(os compressor_plugins) add_dependencies(os crypto_plugins) -if(HAVE_LIBAIO) +if(WITH_BLUESTORE) add_executable(ceph-bluestore-tool bluestore/bluestore_tool.cc) target_link_libraries(ceph-bluestore-tool diff --git a/src/os/ObjectStore.cc b/src/os/ObjectStore.cc index 93c79667d4f1..7bf29be97cb8 100644 --- a/src/os/ObjectStore.cc +++ b/src/os/ObjectStore.cc @@ -20,7 +20,7 @@ #include "filestore/FileStore.h" #include "memstore/MemStore.h" -#if defined(HAVE_LIBAIO) +#if defined(WITH_BLUESTORE) #include "bluestore/BlueStore.h" #endif #include "kstore/KStore.h" @@ -72,7 +72,7 @@ ObjectStore *ObjectStore::create(CephContext *cct, if (type == "memstore") { return new MemStore(cct, data); } -#if defined(HAVE_LIBAIO) +#if defined(WITH_BLUESTORE) if (type == "bluestore") { return new BlueStore(cct, data); } @@ -102,7 +102,7 @@ int ObjectStore::probe_block_device_fsid( { int r; -#if defined(HAVE_LIBAIO) +#if defined(WITH_BLUESTORE) // first try bluestore -- it has a crc on its header and will fail // reliably. r = BlueStore::get_block_device_fsid(cct, path, fsid); diff --git a/src/test/encoding/types.h b/src/test/encoding/types.h index 092dd40322dd..5a0f8b7fe8d4 100644 --- a/src/test/encoding/types.h +++ b/src/test/encoding/types.h @@ -117,7 +117,7 @@ TYPE(ObjectStore::Transaction) #include "os/filestore/SequencerPosition.h" TYPE(SequencerPosition) -#ifdef HAVE_LIBAIO +#ifdef WITH_BLUESTORE #include "os/bluestore/bluestore_types.h" TYPE(bluestore_cnode_t) TYPE(bluestore_compression_header_t) diff --git a/src/test/objectstore/CMakeLists.txt b/src/test/objectstore/CMakeLists.txt index cd361e02ccca..5e0202197bed 100644 --- a/src/test/objectstore/CMakeLists.txt +++ b/src/test/objectstore/CMakeLists.txt @@ -107,7 +107,7 @@ add_executable(unittest_rocksdb_option add_ceph_unittest(unittest_rocksdb_option) target_link_libraries(unittest_rocksdb_option global os ${BLKID_LIBRARIES}) -if(HAVE_LIBAIO) +if(WITH_BLUESTORE) # unittest_bit_alloc add_executable(unittest_bit_alloc BitAllocator_test.cc @@ -136,7 +136,7 @@ if(HAVE_LIBAIO) ) add_ceph_unittest(unittest_bluestore_types) target_link_libraries(unittest_bluestore_types os global) -endif(HAVE_LIBAIO) +endif(WITH_BLUESTORE) # unittest_transaction add_executable(unittest_transaction diff --git a/src/test/objectstore/store_test.cc b/src/test/objectstore/store_test.cc index d549007b96b7..2fcb47140fa6 100644 --- a/src/test/objectstore/store_test.cc +++ b/src/test/objectstore/store_test.cc @@ -26,7 +26,7 @@ #include "os/ObjectStore.h" #include "os/filestore/FileStore.h" -#if defined(HAVE_LIBAIO) +#if defined(WITH_BLUESTORE) #include "os/bluestore/BlueStore.h" #endif #include "include/Context.h" @@ -1327,7 +1327,7 @@ TEST_P(StoreTest, SimpleObjectTest) { } } -#if defined(HAVE_LIBAIO) +#if defined(WITH_BLUESTORE) TEST_P(StoreTestSpecificAUSize, BluestoreStatFSTest) { if(string(GetParam()) != "bluestore") return; @@ -5523,7 +5523,7 @@ TEST_P(StoreTest, TryMoveRename) { ASSERT_EQ(store->stat(cid, hoid2, &st), 0); } -#if defined(HAVE_LIBAIO) +#if defined(WITH_BLUESTORE) TEST_P(StoreTest, BluestoreOnOffCSumTest) { if (string(GetParam()) != "bluestore") return; @@ -5712,7 +5712,7 @@ INSTANTIATE_TEST_CASE_P( ::testing::Values( "memstore", "filestore", -#if defined(HAVE_LIBAIO) +#if defined(WITH_BLUESTORE) "bluestore", #endif "kstore")); @@ -5724,7 +5724,7 @@ INSTANTIATE_TEST_CASE_P( ::testing::Values( "memstore", "filestore", -#if defined(HAVE_LIBAIO) +#if defined(WITH_BLUESTORE) "bluestore", #endif "kstore")); @@ -5823,7 +5823,7 @@ TEST_P(StoreTestSpecificAUSize, TooManyBlobsTest) { ASSERT_EQ(res_stat.allocated, max_object); } -#if defined(HAVE_LIBAIO) +#if defined(WITH_BLUESTORE) void get_mempool_stats(uint64_t* total_bytes, uint64_t* total_items) { uint64_t onode_allocated = mempool::bluestore_cache_onode::allocated_bytes(); @@ -6464,7 +6464,7 @@ TEST_P(StoreTestSpecificAUSize, SmallWriteOnShardedExtents) { g_conf->set_val("bluestore_csum_type", "crc32c"); } -#endif //#if defined(HAVE_LIBAIO) +#endif //#if defined(WITH_BLUESTORE) TEST_P(StoreTest, KVDBHistogramTest) { if (string(GetParam()) != "bluestore") @@ -6549,7 +6549,7 @@ TEST_P(StoreTest, KVDBStatsTest) { g_conf->set_val("rocksdb_collect_memory_stats","false"); } -#if defined(HAVE_LIBAIO) +#if defined(WITH_BLUESTORE) TEST_P(StoreTestSpecificAUSize, garbageCollection) { ObjectStore::Sequencer osr("test"); int r; diff --git a/src/test/objectstore/store_test_fixture.cc b/src/test/objectstore/store_test_fixture.cc index e80bde8315e7..b8875eaa00d7 100644 --- a/src/test/objectstore/store_test_fixture.cc +++ b/src/test/objectstore/store_test_fixture.cc @@ -5,7 +5,7 @@ #include "common/errno.h" #include "os/ObjectStore.h" -#if defined(HAVE_LIBAIO) +#if defined(WITH_BLUESTORE) #include "os/bluestore/BlueStore.h" #endif #include "store_test_fixture.h" @@ -42,7 +42,7 @@ void StoreTestFixture::SetUp() { cerr << __func__ << ": objectstore type " << type << " doesn't exist yet!" << std::endl; } ASSERT_TRUE(store); -#if defined(HAVE_LIBAIO) +#if defined(WITH_BLUESTORE) if (type == "bluestore") { BlueStore *s = static_cast(store.get()); // better test coverage! diff --git a/src/tools/ceph_kvstore_tool.cc b/src/tools/ceph_kvstore_tool.cc index 90a8798b7fdc..6d4288da5445 100644 --- a/src/tools/ceph_kvstore_tool.cc +++ b/src/tools/ceph_kvstore_tool.cc @@ -28,7 +28,7 @@ #include "kv/KeyValueDB.h" #include "common/url_escape.h" -#ifdef HAVE_LIBAIO +#ifdef WITH_BLUESTORE #include "os/bluestore/BlueStore.h" #endif @@ -36,7 +36,7 @@ using namespace std; class StoreTool { -#ifdef HAVE_LIBAIO +#ifdef WITH_BLUESTORE struct Deleter { BlueStore *bluestore; Deleter(BlueStore *store = nullptr) @@ -61,7 +61,7 @@ class StoreTool public: StoreTool(string type, const string &path, bool need_open_db=true) : store_path(path) { if (type == "bluestore-kv") { -#ifdef HAVE_LIBAIO +#ifdef WITH_BLUESTORE auto bluestore = new BlueStore(g_ceph_context, path, need_open_db); KeyValueDB *db_ptr; int r = bluestore->start_kv_only(&db_ptr); -- 2.47.3