Skip to content

Commit

Permalink
Merge pull request ceph#18357 from asomers/have_libaio
Browse files Browse the repository at this point in the history
Build: create a proper WITH_BLUESTORE option

Reviewed-by: Willem Jan Withagen <[email protected]>
Reviewed-By: Kefu Chai <[email protected]>
  • Loading branch information
tchaikov authored Oct 21, 2017
2 parents 1cb521e + 1430f36 commit 4ec719b
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 28 deletions.
12 changes: 6 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions do_freebsd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
3 changes: 3 additions & 0 deletions src/include/config-h.in.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions src/os/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -108,7 +108,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
Expand Down
6 changes: 3 additions & 3 deletions src/os/ObjectStore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/test/encoding/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/test/objectstore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions src/test/objectstore/store_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -5712,7 +5712,7 @@ INSTANTIATE_TEST_CASE_P(
::testing::Values(
"memstore",
"filestore",
#if defined(HAVE_LIBAIO)
#if defined(WITH_BLUESTORE)
"bluestore",
#endif
"kstore"));
Expand All @@ -5724,7 +5724,7 @@ INSTANTIATE_TEST_CASE_P(
::testing::Values(
"memstore",
"filestore",
#if defined(HAVE_LIBAIO)
#if defined(WITH_BLUESTORE)
"bluestore",
#endif
"kstore"));
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/test/objectstore/store_test_fixture.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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<BlueStore*>(store.get());
// better test coverage!
Expand Down
6 changes: 3 additions & 3 deletions src/tools/ceph_kvstore_tool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@
#include "kv/KeyValueDB.h"
#include "common/url_escape.h"

#ifdef HAVE_LIBAIO
#ifdef WITH_BLUESTORE
#include "os/bluestore/BlueStore.h"
#endif

using namespace std;

class StoreTool
{
#ifdef HAVE_LIBAIO
#ifdef WITH_BLUESTORE
struct Deleter {
BlueStore *bluestore;
Deleter(BlueStore *store = nullptr)
Expand All @@ -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);
Expand Down

0 comments on commit 4ec719b

Please sign in to comment.