Skip to content

Commit

Permalink
Add first attempt for support libelasto stored backend.
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco van Wieringen committed Nov 30, 2014
1 parent cba47eb commit 90898d9
Show file tree
Hide file tree
Showing 10 changed files with 529 additions and 11 deletions.
52 changes: 52 additions & 0 deletions autoconf/configure.in
Expand Up @@ -3881,6 +3881,53 @@ fi
AC_SUBST(CEPHFS_INC)
AC_SUBST(CEPHFS_LIBS)

dnl
dnl Check for AZURE via libelasto_file.
dnl
ELASTO_LIBS="-lelasto_file"
ELASTO_INC=""
have_elasto=no
AC_ARG_WITH(elasto,
AC_HELP_STRING([--with-elasto@<:@=DIR@:>@], [Directory holding ELASTO includes/libs]),
with_elasto_directory=$withval
)

if test "x${with_elasto_directory}" != "xyes" && test x"${with_elasto_directory}" != "x"; then
#
# Make sure the $with_elasto_directory also makes sense
#
if test -d "${with_elasto_directory}/lib" -a -d "${with_elasto_directory}/include"; then
ELASTO_LIBS="-L${with_elasto_directory}/lib ${ELASTO_LIBS}"
ELASTO_INC="-I${with_elasto_directory}/include ${ELASTO_INC}"
fi
fi

saved_LIBS="${LIBS}"
saved_CFLAGS="${CFLAGS}"
saved_CPPFLAGS="${CPPFLAGS}"
LIBS="${saved_LIBS} ${ELASTO_LIBS}"
CFLAGS="${saved_CFLAGS} ${ELASTO_INC}"
CPPFLAGS="${saved_CPPFLAGS} ${ELASTO_INC}"

AC_CHECK_HEADER(elasto/data.h)
AC_CHECK_HEADER(elasto/file.h)

AC_CHECK_LIB(elasto_file, elasto_fclose, have_elasto="yes")

LIBS="${saved_LIBS}"
CFLAGS="${saved_CFLAGS}"
CPPFLAGS="${saved_CPPFLAGS}"

if test "x${have_elasto}" = "xyes"; then
AC_DEFINE(HAVE_ELASTO, 1, [Define to 1 if you have elasto lib])
else
ELASTO_LIBS=""
ELASTO_INC=""
fi

AC_SUBST(ELASTO_INC)
AC_SUBST(ELASTO_LIBS)

dnl
dnl Check for pthread libraries
dnl
Expand Down Expand Up @@ -4323,6 +4370,10 @@ if test x$use_libtool != xno; then
if test X"$have_cephfs" = "Xyes" ; then
BUILD_SD_BACKENDS="${BUILD_SD_BACKENDS} libbareossd-cephfs.la"
fi

if test X"$have_elasto" = "Xyes" ; then
BUILD_SD_BACKENDS="${BUILD_SD_BACKENDS} libbareossd-elasto.la"
fi
else
BUILD_SD_BACKENDS=""
fi
Expand Down Expand Up @@ -4591,6 +4642,7 @@ Configuration on `date`:
CEPH RADOS support: ${have_ceph_rados}
RADOS striping support: ${have_ceph_rados_striper}
CEPHFS support: ${have_cephfs}
ELASTO support: ${have_elasto}
Python support: ${support_python} ${PYTHON_LIBS}
systemd support: ${support_systemd} ${SYSTEMD_UNITDIR}
Batch insert enabled: ${batch_insert_db_backends}
Expand Down
13 changes: 10 additions & 3 deletions src/stored/Makefile.in
Expand Up @@ -28,6 +28,7 @@ first_rule: all
dummy:

AVAILABLE_DEVICE_API_SRCS = cephfs_device.c \
elasto_device.c \
gfapi_device.c \
object_store_device.c \
rados_device.c \
Expand All @@ -37,10 +38,11 @@ AVAILABLE_DEVICE_API_SRCS = cephfs_device.c \
NEEDED_DEVICE_API_SRCS = unix_file_device.c @NEEDED_DEVICE_API_SRCS@

CEPHFS_LIBS = @CEPHFS_LIBS@
ELASTO_LIBS = @ELASTO_LIBS@
DROPLET_LIBS = @DROPLET_LIBS@
GLUSTER_LIBS = @GLUSTER_LIBS@
RADOS_LIBS = @RADOS_LIBS@
AVAILABLE_BACKEND_LIBS = $(CEPHFS_LIBS) $(DROPLET_LIBS) $(GLUSTER_LIBS) $(RADOS_LIBS)
AVAILABLE_BACKEND_LIBS = $(CEPHFS_LIBS) $(ELASTO_LIBS) $(DROPLET_LIBS) $(GLUSTER_LIBS) $(RADOS_LIBS)
LIBS += @NEEDED_BACKEND_LIBS@

# objects used in all daemons collected in (shared) library.
Expand Down Expand Up @@ -84,6 +86,7 @@ BEXTRACT_LIBS += @LZO_LIBS_NONSHARED@
BEXTRACT_LIBS += @FASTLZ_LIBS_NONSHARED@

CEPHFS_INC = @CEPHFS_INC@
ELASTO_INC = @ELASTO_INC@
DROPLET_INC = @DROPLET_INC@
GLUSTER_INC = @GLUSTER_INC@
RADOS_INC = @RADOS_INC@
Expand Down Expand Up @@ -126,11 +129,15 @@ libbareossd.la: Makefile $(LIBBAREOSSD_LOBJS)

dev.lo: dev.c
@echo "Compiling $<"
$(NO_ECHO)$(LIBTOOL_COMPILE) $(CXX) $(DEFS) $(DEBUG) $(CEPHFS_INC) $(GLUSTER_INC) $(DROPLET_INC) $(RADOS_INC) -c $(WCFLAGS) $(CPPFLAGS) $(INCLUDES) $(DINCLUDE) $(CXXFLAGS) $<
$(NO_ECHO)$(LIBTOOL_COMPILE) $(CXX) $(DEFS) $(DEBUG) $(CEPHFS_INC) $(ELASTO_INC) $(GLUSTER_INC) $(DROPLET_INC) $(RADOS_INC) -c $(WCFLAGS) $(CPPFLAGS) $(INCLUDES) $(DINCLUDE) $(CXXFLAGS) $<

cephfs_device.lo: cephfs_device.c
@echo "Compiling $<"
$(NO_ECHO)$(LIBTOOL_COMPILE) $(CXX) $(DEFS) $(DEBUG) -c $(WCFLAGS) $(CPPFLAGS) $(INCLUDES) $(DINCLUDE) $(CXXFLAGS) $<
$(NO_ECHO)$(LIBTOOL_COMPILE) $(CXX) $(DEFS) $(DEBUG) $(CEPHFS_INC) -c $(WCFLAGS) $(CPPFLAGS) $(INCLUDES) $(DINCLUDE) $(CXXFLAGS) $<

elasto_device.lo: elasto_device.c
@echo "Compiling $<"
$(NO_ECHO)$(LIBTOOL_COMPILE) $(CXX) $(DEFS) $(DEBUG) $(ELASTO_INC) -c $(WCFLAGS) $(CPPFLAGS) $(INCLUDES) $(DINCLUDE) $(CXXFLAGS) $<

gfapi_device.lo: gfapi_device.c
@echo "Compiling $<"
Expand Down
14 changes: 14 additions & 0 deletions src/stored/backends/Makefile.in
Expand Up @@ -19,17 +19,22 @@ dummy:

CEPHFS_INC = @CEPHFS_INC@
DROPLET_INC = @DROPLET_INC@
ELASTO_INC = @ELASTO_INC@
GLUSTER_INC = @GLUSTER_INC@
RADOS_INC = @RADOS_INC@ @RADOS_STRIPER_INC@

CEPHFS_LIBS = @CEPHFS_LIBS@
DROPLET_LIBS = @DROPLET_LIBS@
ELASTO_LIBS = @ELASTO_LIBS@
GLUSTER_LIBS = @GLUSTER_LIBS@
RADOS_LIBS = @RADOS_STRIPER_LIBS@ @RADOS_LIBS@

CHEPHFS_SRCS = cephfs_device.c
CHEPHFS_LOBJS = $(CHEPHFS_SRCS:.c=.lo)

ELASTO_SRCS = elasto_device.c
ELASTO_LOBJS = $(ELASTO_SRCS:.c=.lo)

GFAPI_SRCS = gfapi_device.c
GFAPI_LOBJS = $(GFAPI_SRCS:.c=.lo)

Expand Down Expand Up @@ -68,6 +73,10 @@ INSTALL_CONFS = @INSTALL_SD_CONFS@
@echo "Compiling $<"
$(NO_ECHO)$(LIBTOOL_COMPILE) $(CXX) $(DEFS) $(DEBUG) -c $(WCFLAGS) $(CPPFLAGS) $(INCLUDES) $(DINCLUDE) $(CXXFLAGS) $<

$(ELASTO_LOBJS):
@echo "Compiling $(@:.lo=.c)"
$(NO_ECHO)$(LIBTOOL_COMPILE) $(CXX) $(DEFS) $(DEBUG) -c $(WCFLAGS) $(CPPFLAGS) $(INCLUDES) $(ELASTO_INC) $(DINCLUDE) $(CXXFLAGS) $(@:.lo=.c)

$(CHEPHFS_LOBJS):
@echo "Compiling $(@:.lo=.c)"
$(NO_ECHO)$(LIBTOOL_COMPILE) $(CXX) $(DEFS) $(DEBUG) -c $(WCFLAGS) $(CPPFLAGS) $(INCLUDES) $(CEPHFS_INC) $(DINCLUDE) $(CXXFLAGS) $(@:.lo=.c)
Expand All @@ -94,6 +103,11 @@ libbareossd-cephfs.la: Makefile $(CHEPHFS_LOBJS)
$(LIBTOOL_LINK) $(CXX) $(DEFS) $(DEBUG) $(LDFLAGS) -o $@ $(CHEPHFS_LOBJS) -export-dynamic -rpath $(backenddir) -release $(LIBBAREOSSD_LT_RELEASE) \
-soname libbareossd-cephfs-$(LIBBAREOSSD_LT_RELEASE).so $(CEPHFS_LIBS)

libbareossd-elasto.la: Makefile $(ELASTO_LOBJS)
@echo "Making $@ ..."
$(LIBTOOL_LINK) $(CXX) $(DEFS) $(DEBUG) $(LDFLAGS) -o $@ $(ELASTO_LOBJS) -export-dynamic -rpath $(backenddir) -release $(LIBBAREOSSD_LT_RELEASE) \
-soname libbareossd-cephfs-$(LIBBAREOSSD_LT_RELEASE).so $(ELASTO_LIBS)

libbareossd-gfapi.la: Makefile $(GFAPI_LOBJS)
@echo "Making $@ ..."
$(LIBTOOL_LINK) $(CXX) $(DEFS) $(DEBUG) $(LDFLAGS) -o $@ $(GFAPI_LOBJS) -export-dynamic -rpath $(backenddir) -release $(LIBBAREOSSD_LT_RELEASE) \
Expand Down
12 changes: 5 additions & 7 deletions src/stored/backends/cephfs_device.c
Expand Up @@ -44,14 +44,12 @@ int cephfs_device::d_open(const char *pathname, int flags, int mode)
m_cephfs_configstring = bstrdup(dev_name);
bp = strchr(m_cephfs_configstring, ':');
if (!bp) {
Mmsg1(errmsg, _("Unable to parse device %s.\n"), dev_name);
Emsg0(M_FATAL, 0, errmsg);
goto bail_out;
m_cephfs_conffile = m_cephfs_configstring;
} else {
*bp++ = '\0';
m_cephfs_conffile = m_cephfs_configstring;
m_basedir = bp;
}

*bp++ = '\0';
m_cephfs_conffile = m_cephfs_configstring;
m_basedir = bp;
}

if (!m_cmount) {
Expand Down

0 comments on commit 90898d9

Please sign in to comment.