From c6d056421df64e546add06389ef5ae875dfc2285 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Mon, 22 Apr 2019 15:13:22 -0700 Subject: [PATCH] ircd::db: Log warning when crc32c acceleration is not available. --- ircd/db.cc | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/ircd/db.cc b/ircd/db.cc index b62993b6b..28f47da1f 100644 --- a/ircd/db.cc +++ b/ircd/db.cc @@ -86,6 +86,7 @@ ircd::db::write_mutex; namespace ircd::db { static std::string direct_io_test_file_path(); + static void init_test_hw_crc32(); static void init_test_direct_io(); static void init_compressions(); static void init_directory(); @@ -141,6 +142,7 @@ ircd::db::init::init() init_compressions(); init_directory(); init_test_direct_io(); + init_test_hw_crc32(); request.add(request_pool_size); } @@ -254,6 +256,33 @@ ircd::db::direct_io_test_file_path() return fs::path_string(fs::DB, test_file_name); } +namespace rocksdb::crc32c +{ + extern std::string IsFastCrc32Supported(); +} + +void +ircd::db::init_test_hw_crc32() +{ + const auto supported_str + { + rocksdb::crc32c::IsFastCrc32Supported() + }; + + const bool supported + { + startswith(supported_str, "Supported") + }; + + assert(supported || startswith(supported_str, "Not supported")); + + if(!supported) + log::warning + { + log, "crc32c hardware acceleration is not available on this platform." + }; +} + decltype(ircd::db::compressions) ircd::db::compressions;