diff --git a/.gitignore b/.gitignore index 97b58ba32..816ffced6 100644 --- a/.gitignore +++ b/.gitignore @@ -105,3 +105,4 @@ cmake-*/** # Visual Studio CMakeSettings.json .vs/** +.cache diff --git a/conanfile.py b/conanfile.py index 1d2ad18cb..bf4ffbe20 100644 --- a/conanfile.py +++ b/conanfile.py @@ -5,7 +5,7 @@ class HomestoreConan(ConanFile): name = "homestore" - version = "4.9.3" + version = "4.9.4" homepage = "https://github.com/eBay/Homestore" description = "HomeStore Storage Engine" @@ -59,7 +59,8 @@ def requirements(self): self.requires("sisl/[>=10.3]") self.requires("farmhash/cci.20190513@") - self.requires("isa-l/2.30.0") + if self.settings.arch in ['x86', 'x86_64']: + self.requires("isa-l/2.30.0") self.requires("spdk/21.07.y") def build(self): diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 30329c54e..6a7109d6c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -3,25 +3,29 @@ cmake_minimum_required(VERSION 3.13) set(CMAKE_THREAD_PREFER_PTHREAD TRUE) find_package(Threads) -find_library(LIB_AIO aio REQUIRED) -find_package(isa-l REQUIRED) -find_package(iomgr REQUIRED) -find_package(farmhash REQUIRED) -find_package(GTest REQUIRED) - -set (COMMON_DEPS - iomgr::iomgr - farmhash::farmhash - isa-l::isa-l - sisl::sisl - ) - -set(COMMON_TEST_DEPS - ${COMMON_DEPS} - ${spdk_LIBRARY_LIST} - ${dpdk_LIBRARY_LIST} - GTest::gmock - ) +find_library(LIB_AIO aio QUIET REQUIRED) +find_package(isa-l QUIET) +find_package(iomgr QUIET REQUIRED) +find_package(farmhash QUIET REQUIRED) +find_package(GTest QUIET REQUIRED) + +list(APPEND COMMON_DEPS + iomgr::iomgr + farmhash::farmhash + sisl::sisl +) +if (${isa-l_FOUND}) + list(APPEND COMMON_DEPS isa-l::isa-l) +else () + add_flags("-DNO_ISAL") +endif() + +list(APPEND COMMON_TEST_DEPS + ${COMMON_DEPS} + ${spdk_LIBRARY_LIST} + ${dpdk_LIBRARY_LIST} + GTest::gmock +) include_directories (BEFORE lib/) include_directories (BEFORE include/) @@ -49,6 +53,7 @@ set(HOMESTORE_OBJECTS $ $ lib/homestore.cpp + lib/crc.cpp #$ #$ ) diff --git a/src/include/homestore/btree/detail/btree_node.hpp b/src/include/homestore/btree/detail/btree_node.hpp index 8f713e534..6428e9c06 100644 --- a/src/include/homestore/btree/detail/btree_node.hpp +++ b/src/include/homestore/btree/detail/btree_node.hpp @@ -24,8 +24,7 @@ #include #include "btree_internal.hpp" #include -// #include -#include +#include namespace homestore { ENUM(locktype_t, uint8_t, NONE, READ, WRITE) diff --git a/src/include/homestore/crc.h b/src/include/homestore/crc.h new file mode 100644 index 000000000..9c21f3d6c --- /dev/null +++ b/src/include/homestore/crc.h @@ -0,0 +1,16 @@ +#pragma once + +// Only x86 and x86_64 supported by Intel Storage Acceleration library +#ifndef NO_ISAL +#include + +#else + +extern "C" { +// crc16_t10dif reference function, slow crc16 from the definition. +uint16_t crc16_t10dif(uint16_t seed, const unsigned char* buf, uint64_t len); + +// crc32_ieee reference function, slow crc32 from the definition. +uint32_t crc32_ieee(uint32_t seed, const unsigned char* buf, uint64_t len); +} +#endif diff --git a/src/lib/crc.cpp b/src/lib/crc.cpp new file mode 100644 index 000000000..9b1b296a1 --- /dev/null +++ b/src/lib/crc.cpp @@ -0,0 +1,43 @@ +// Only x86 and x86_64 supported by Intel Storage Acceleration library +#ifdef NO_ISAL + +#include +#include +extern "C" { +#define MAX_ITER 8 + +// crc16_t10dif reference function, slow crc16 from the definition. +uint16_t crc16_t10dif(uint16_t seed, const unsigned char* buf, uint64_t len) { + size_t rem = seed; + unsigned int i, j; + + uint16_t poly = 0x8bb7; // t10dif standard + + for (i = 0; i < len; i++) { + rem = rem ^ (buf[i] << 8); + for (j = 0; j < MAX_ITER; j++) { + rem = rem << 1; + rem = (rem & 0x10000) ? rem ^ poly : rem; + } + } + return rem; +} + +// crc32_ieee reference function, slow crc32 from the definition. +uint32_t crc32_ieee(uint32_t seed, const unsigned char* buf, uint64_t len) { + uint64_t rem = ~seed; + unsigned int i, j; + + uint32_t poly = 0x04C11DB7; // IEEE standard + + for (i = 0; i < len; i++) { + rem = rem ^ ((uint64_t)buf[i] << 24); + for (j = 0; j < MAX_ITER; j++) { + rem = rem << 1; + rem = (rem & 0x100000000ULL) ? rem ^ poly : rem; + } + } + return ~rem; +} +} +#endif diff --git a/src/lib/device/device.h b/src/lib/device/device.h index ad8749576..59500e1ad 100644 --- a/src/lib/device/device.h +++ b/src/lib/device/device.h @@ -17,7 +17,7 @@ #include #include -#include +#include #include #include #include diff --git a/src/lib/device/device_manager.cpp b/src/lib/device/device_manager.cpp index ecab5562c..0ae9d7d6f 100644 --- a/src/lib/device/device_manager.cpp +++ b/src/lib/device/device_manager.cpp @@ -15,7 +15,7 @@ #include #include -#include +#include #include #include diff --git a/src/lib/device/physical_dev.cpp b/src/lib/device/physical_dev.cpp index 33f243824..3f250372b 100644 --- a/src/lib/device/physical_dev.cpp +++ b/src/lib/device/physical_dev.cpp @@ -22,7 +22,6 @@ #include #include #include -#include #include #include "device/chunk.h" diff --git a/src/lib/device/physical_dev.hpp b/src/lib/device/physical_dev.hpp index 951e61f34..eb5cb52c9 100644 --- a/src/lib/device/physical_dev.hpp +++ b/src/lib/device/physical_dev.hpp @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include #include diff --git a/src/lib/logstore/log_dev.cpp b/src/lib/logstore/log_dev.cpp index b8ea1e2ef..c6d035d09 100644 --- a/src/lib/logstore/log_dev.cpp +++ b/src/lib/logstore/log_dev.cpp @@ -19,7 +19,6 @@ #include #include -#include #include #include diff --git a/src/lib/logstore/log_group.cpp b/src/lib/logstore/log_group.cpp index 7c68e581d..a94ff7fa1 100644 --- a/src/lib/logstore/log_group.cpp +++ b/src/lib/logstore/log_group.cpp @@ -15,8 +15,6 @@ *********************************************************************************/ #include -#include - #include #include "common/homestore_assert.hpp" #include "log_dev.hpp" diff --git a/src/lib/logstore/log_stream.cpp b/src/lib/logstore/log_stream.cpp index d7c0ce8e2..70712d942 100644 --- a/src/lib/logstore/log_stream.cpp +++ b/src/lib/logstore/log_stream.cpp @@ -13,8 +13,6 @@ * specific language governing permissions and limitations under the License. * *********************************************************************************/ -#include - #include "device/chunk.h" #include "common/homestore_assert.hpp" #include "common/homestore_config.hpp" diff --git a/src/lib/meta/meta_blk_service.cpp b/src/lib/meta/meta_blk_service.cpp index 03cfd1ae7..993e65099 100644 --- a/src/lib/meta/meta_blk_service.cpp +++ b/src/lib/meta/meta_blk_service.cpp @@ -24,7 +24,6 @@ #include #include -#include #include #include