Merge pull request #7393 from tchaikov/wip-cmake

fix the autotools and cmake build (the new fusestore needs libfuse)

Reviewed-by: Piotr Dałek <piotr.dalek@ts.fujitsu.com>
Reviewed-by: Casey Bodley <cbodley@redhat.com>
This commit is contained in:
Kefu Chai 2016-01-29 00:43:38 +08:00
commit 2d75c9d85b
9 changed files with 38 additions and 32 deletions

View File

@ -126,7 +126,7 @@ endif(${WITH_AIO})
option(WITH_FUSE "Fuse is here" ON)
if(${WITH_FUSE})
find_package(fuse)
set(HAVE_FUSE ${FUSE_FOUND})
set(HAVE_LIBFUSE ${FUSE_FOUND})
CHECK_FUNCTION_EXISTS(fuse_getgroups HAVE_FUSE_GETGROUPS)
endif(${WITH_FUSE})

View File

@ -1,21 +1,3 @@
# Copyright (C) 2007-2012 Hypertable, Inc.
#
# This file is part of Hypertable.
#
# Hypertable is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or any later version.
#
# Hypertable is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Hypertable. If not, see <http://www.gnu.org/licenses/>
#
# - Find Snappy
# Find the snappy compression library and includes
#

View File

@ -523,7 +523,8 @@ AC_ARG_WITH([fuse],
LIBFUSE=
AS_IF([test "x$with_fuse" != xno], [
PKG_CHECK_MODULES([LIBFUSE], [fuse],
[HAVE_LIBFUSE=1],
[HAVE_LIBFUSE=1
AC_DEFINE([HAVE_LIBFUSE], [1], [Define if you have fuse])],
[AC_MSG_FAILURE([no FUSE found (use --without-fuse to disable)])])
])
AM_CONDITIONAL(WITH_FUSE, [test "$HAVE_LIBFUSE" = "1"])

View File

@ -626,7 +626,6 @@ if(${HAVE_XFS})
os/fs/XFS.cc)
endif(${HAVE_XFS})
set(libos_srcs
os/FuseStore.cc
os/ObjectStore.cc
os/Transaction.cc
os/filestore/chain_xattr.cc
@ -656,6 +655,10 @@ set(libos_srcs
os/bluestore/StupidAllocator.cc
os/fs/FS.cc
${libos_xfs_srcs})
if(${HAVE_LIBFUSE})
list(APPEND libos_srcs
os/FuseStore.cc)
endif(${HAVE_LIBFUSE})
# make rocksdb statically
add_custom_target(build_rocksdb
@ -679,6 +682,9 @@ endif(${HAVE_LIBAIO})
if(${WITH_LTTNG})
target_link_libraries(os libos_tp)
endif(${WITH_LTTNG})
if(${HAVE_LIBFUSE})
target_link_libraries(os ${FUSE_LIBRARIES})
endif(${HAVE_LIBFUSE})
target_link_libraries(os kv)
set(cls_references_files objclass/class_api.cc)
@ -728,7 +734,10 @@ add_executable(ceph-osd ${ceph_osd_srcs}
$<TARGET_OBJECTS:heap_profiler_objs>
$<TARGET_OBJECTS:common_util_obj>)
add_dependencies(ceph-osd erasure_code_plugins)
target_link_libraries(ceph-osd osd os global ${BLKID_LIBRARIES} ${ALLOC_LIBS} fuse)
target_link_libraries(ceph-osd osd os global ${BLKID_LIBRARIES} ${ALLOC_LIBS})
if(${HAVE_LIBFUSE})
target_link_libraries(ceph-osd ${FUSE_LIBRARIES})
endif(${HAVE_LIBFUSE})
install(TARGETS ceph-osd DESTINATION bin)
# MDS
@ -928,15 +937,15 @@ endif(${ENABLE_SHARED})
install(TARGETS ceph-syn DESTINATION bin)
install(TARGETS mount.ceph DESTINATION sbin)
if(HAVE_FUSE)
if(HAVE_LIBFUSE)
set(ceph_fuse_srcs
ceph_fuse.cc
client/fuse_ll.cc)
add_executable(ceph-fuse ${ceph_fuse_srcs})
target_link_libraries(ceph-fuse fuse client global)
target_link_libraries(ceph-fuse ${FUSE_LIBRARIES} client global)
set_target_properties(ceph-fuse PROPERTIES COMPILE_FLAGS "-I${FUSE_INCLUDE_DIRS}")
install(TARGETS ceph-fuse DESTINATION bin)
endif(HAVE_FUSE)
endif(HAVE_LIBFUSE)
endif(WITH_LIBCEPHFS)
set(journal_srcs

View File

@ -27,9 +27,12 @@ libos_a_SOURCES = \
os/kstore/kv.cc \
os/kstore/KStore.cc \
os/memstore/MemStore.cc \
os/FuseStore.cc \
os/ObjectStore.cc
if WITH_FUSE
libos_a_SOURCES += os/FuseStore.cc
endif
if WITH_LIBAIO
libos_a_SOURCES += \
os/bluestore/kv.cc \

View File

@ -44,7 +44,9 @@
#include "common/io_priority.h"
#include "os/ObjectStore.h"
#ifdef HAVE_LIBFUSE
#include "os/FuseStore.h"
#endif
#include "ReplicatedPG.h"
@ -1550,7 +1552,6 @@ OSD::OSD(CephContext *cct_, ObjectStore *store_,
logger(NULL),
recoverystate_perf(NULL),
store(store_),
fuse_store(NULL),
log_client(cct, client_messenger, &mc->monmap, LogClient::NO_FLAGS),
clog(log_client.create_channel()),
whoami(id),
@ -1814,6 +1815,7 @@ public:
int OSD::enable_disable_fuse(bool stop)
{
#ifdef HAVE_LIBFUSE
int r;
string mntpath = g_conf->osd_data + "/fuse";
if (fuse_store && (stop || !g_conf->osd_objectstore_fuse)) {
@ -1848,6 +1850,7 @@ int OSD::enable_disable_fuse(bool stop)
return r;
}
}
#endif // HAVE_LIBFUSE
return 0;
}
@ -8684,12 +8687,13 @@ void OSD::handle_conf_change(const struct md_config_t *conf,
changed.count("clog_to_syslog_facility")) {
update_log_config();
}
#ifdef HAVE_LIBFUSE
if (changed.count("osd_objectstore_fuse")) {
if (store) {
enable_disable_fuse(false);
}
}
#endif
check_config();
}

View File

@ -1080,8 +1080,9 @@ protected:
PerfCounters *logger;
PerfCounters *recoverystate_perf;
ObjectStore *store;
FuseStore *fuse_store;
#ifdef HAVE_LIBFUSE
FuseStore *fuse_store = nullptr;
#endif
LogClient log_client;
LogChannelRef clog;

View File

@ -2335,7 +2335,7 @@ target_link_libraries(test_keyvaluedb_iterators
${CMAKE_DL_LIBS}
)
if(${HAVE_FUSE})
if(${HAVE_LIBFUSE})
add_executable(test_cfuse_cache_invalidate
test_cfuse_cache_invalidate.cc
)
@ -2346,7 +2346,7 @@ if(${HAVE_FUSE})
${ALLOC_LIBS}
${CMAKE_DL_LIBS}
)
endif(${HAVE_FUSE})
endif(${HAVE_LIBFUSE})
if(${WITH_CEPHFS})
add_executable(test_c_headers

View File

@ -26,7 +26,9 @@
#include "os/ObjectStore.h"
#include "os/filestore/FileJournal.h"
#ifdef HAVE_LIBFUSE
#include "os/FuseStore.h"
#endif
#include "osd/PGLog.h"
#include "osd/OSD.h"
@ -2485,6 +2487,7 @@ int main(int argc, char **argv)
}
if (op == "fuse") {
#ifdef HAVE_LIBFUSE
FuseStore fuse(fs, mountpoint);
cout << "mounting fuse at " << mountpoint << " ..." << std::endl;
int r = fuse.main();
@ -2492,6 +2495,9 @@ int main(int argc, char **argv)
cerr << "failed to mount fuse: " << cpp_strerror(r) << std::endl;
myexit(1);
}
#else
cerr << "fuse support not enabled" << std::endl;
#endif
myexit(0);
}