reduce: add configure option

--with-reduce required to build reduce.  This depends on
libpmem being installed.

We still need to work out details in pkgdep.sh and
vm_setup.sh.  Some distributions like Ubuntu still
require configuring extra package repositories to
get libpmem packages.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I4e056ce1da9a1fecb4458f8f5e7ff5d61c422533

Reviewed-on: https://review.gerrithub.io/430646
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Jim Harris 2018-09-21 07:37:54 -07:00
parent f28f81333f
commit 970228038f
8 changed files with 39 additions and 3 deletions

3
CONFIG
View File

@ -96,6 +96,9 @@ CONFIG_VIRTIO=y
CONFIG_PMDK=n
CONFIG_PMDK_DIR=
# Build with "reduce" (SPDK block compression)
CONFIG_REDUCE=n
# Build with VPP
CONFIG_VPP=n
CONFIG_VPP_DIR=

16
configure vendored
View File

@ -48,6 +48,8 @@ function usage()
echo " No path required."
echo " pmdk Required to build persistent memory bdev."
echo " example: /usr/share/pmdk"
echo " reduce Required to build \"reduce\" (SPDK block compression)."
echo " No path required."
echo " vpp Required to build VPP net module."
echo " example: /vpp_repo/build-root/install-vpp-native/vpp"
echo " rbd [disabled]"
@ -220,6 +222,12 @@ for i in "$@"; do
--without-pmdk)
CONFIG[PMDK]=n
;;
--with-reduce)
CONFIG[REDUCE]=y
;;
--without-reduce)
CONFIG[REDUCE]=n
;;
--with-vpp)
CONFIG[VPP]=y
;;
@ -367,6 +375,14 @@ if [[ "${CONFIG[CRYPTO]}" = "y" ]]; then
fi
fi
if [[ "${CONFIG[REDUCE]}" = "y" ]]; then
if [ ! -f /usr/include/libpmem.h ]; then
echo --with-reduce requires libpmem.
echo Please install then re-run this script.
exit 1
fi
fi
# We are now ready to generate final configuration. But first do sanity
# check to see if all keys in CONFIG array have its reflection in CONFIG file.
if [ $(egrep -c "^\s*CONFIG_[[:alnum:]_]+=" CONFIG) -ne ${#CONFIG[@]} ]; then

View File

@ -36,13 +36,15 @@ include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
DIRS-y += bdev blob blobfs conf copy event json jsonrpc \
log lvol net rpc sock thread trace util nvme nvmf scsi ioat \
ut_mock iscsi reduce
ut_mock iscsi
ifeq ($(OS),Linux)
DIRS-y += nbd
DIRS-$(CONFIG_VHOST) += vhost
DIRS-$(CONFIG_VIRTIO) += virtio
endif
DIRS-$(CONFIG_REDUCE) += reduce
# If CONFIG_ENV is pointing at a directory in lib, build it.
# Out-of-tree env implementations must be built separately by the user.
ENV_NAME := $(notdir $(CONFIG_ENV))

View File

@ -37,6 +37,8 @@
#include "spdk/string.h"
#include "spdk_internal/log.h"
#include "libpmem.h"
/* Always round up the size of the PM region to the nearest cacheline. */
#define REDUCE_PM_SIZE_ALIGNMENT 64

View File

@ -20,6 +20,7 @@ SPDK_TEST_EVENT=1
SPDK_TEST_BLOBFS=0
SPDK_TEST_PMDK=0
SPDK_TEST_LVOL=0
SPDK_TEST_REDUCE=0
SPDK_RUN_ASAN=1
SPDK_RUN_UBSAN=1
# Reduce the size of the hugepages

View File

@ -56,6 +56,7 @@ fi
: ${SPDK_TEST_PMDK=1}; export SPDK_TEST_PMDK
: ${SPDK_TEST_LVOL=1}; export SPDK_TEST_LVOL
: ${SPDK_TEST_JSON=1}; export SPDK_TEST_JSON
: ${SPDK_TEST_REDUCE=1}; export SPDK_TEST_REDUCE
: ${SPDK_RUN_ASAN=1}; export SPDK_RUN_ASAN
: ${SPDK_RUN_UBSAN=1}; export SPDK_RUN_UBSAN
: ${SPDK_RUN_INSTALLED_DPDK=1}; export SPDK_RUN_INSTALLED_DPDK
@ -152,6 +153,14 @@ else
SPDK_TEST_PMDK=0; export SPDK_TEST_PMDK
fi
if [ -f /usr/include/libpmem.h ]; then
config_params+=' --with-reduce'
else
# PMDK not installed so disable any reduce tests explicitly here
# since reduce depends on libpmem
SPDK_TEST_REDUCE=0; export SPDK_TEST_REDUCE
fi
if [ -d /usr/src/fio ]; then
config_params+=' --with-fio=/usr/src/fio'
fi

View File

@ -35,7 +35,8 @@ SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
DIRS-y = bdev blob blobfs event ioat iscsi json jsonrpc log lvol
DIRS-y += nvme nvmf reduce scsi sock thread util
DIRS-y += nvme nvmf scsi sock thread util
DIRS-$(CONFIG_REDUCE) += reduce
ifeq ($(OS),Linux)
DIRS-$(CONFIG_VHOST) += vhost
endif

View File

@ -121,7 +121,9 @@ $valgrind $testdir/lib/iscsi/iscsi.c/iscsi_ut
$valgrind $testdir/lib/iscsi/init_grp.c/init_grp_ut $testdir/lib/iscsi/init_grp.c/init_grp.conf
$valgrind $testdir/lib/iscsi/portal_grp.c/portal_grp_ut $testdir/lib/iscsi/portal_grp.c/portal_grp.conf
$valgrind $testdir/lib/reduce/reduce.c/reduce_ut
if grep -q '#define SPDK_CONFIG_REDUCE 1' $rootdir/config.h; then
$valgrind $testdir/lib/reduce/reduce.c/reduce_ut
fi
$valgrind $testdir/lib/thread/thread.c/thread_ut