sys-cluster/ceph: revbump to 14.2.4-r1, misc fixes

Copyright: Sony Interactive Entertainment Inc.
Package-Manager: Portage-2.3.78, Repoman-2.3.17
Signed-off-by: Patrick McLean <chutzpah@gentoo.org>
This commit is contained in:
Patrick McLean
2019-11-08 15:25:23 -08:00
committed by Patrick McLean
parent 4ee3591bb6
commit 8c9da308d9
3 changed files with 109 additions and 0 deletions
@@ -154,6 +154,8 @@ PATCHES=(
"${FILESDIR}/ceph-14.2.0-cython-0.29.patch"
"${FILESDIR}/ceph-14.2.3-boost-1.70.patch"
"${FILESDIR}/ceph-14.2.3-dpdk-compile-fix-1.patch"
"${FILESDIR}/ceph-14.2.4-python-executable.patch"
"${FILESDIR}/ceph-14.2.4-undefined-behaviour.patch"
)
# dpdk and ninja don't get along
@@ -294,6 +296,8 @@ python_install() {
pushd "${BUILD_DIR}/src/pybind" >/dev/null || die
DESTDIR="${ED}" emake VERBOSE=1 install
popd >/dev/null || die
python_optimize
}
src_install() {
@@ -0,0 +1,29 @@
diff --git a/src/ceph-crash.in b/src/ceph-crash.in
index 5bfb50c474..d53c4eeb6a 100755
--- a/src/ceph-crash.in
+++ b/src/ceph-crash.in
@@ -1,4 +1,4 @@
-#!@PYTHON_EXECUTABLE@
+#!@PYTHON3_EXECUTABLE@
# -*- mode:python -*-
# vim: ts=4 sw=4 smarttab expandtab
diff --git a/src/ceph.in b/src/ceph.in
index f060023f57..3a84263ccc 100755
--- a/src/ceph.in
+++ b/src/ceph.in
@@ -1,4 +1,4 @@
-#!@PYTHON_EXECUTABLE@
+#!@PYTHON3_EXECUTABLE@
# -*- mode:python -*-
# vim: ts=4 sw=4 smarttab expandtab
#
@@ -66,7 +66,7 @@ DEVMODEMSG = '*** DEVELOPER MODE: setting PATH, PYTHONPATH and LD_LIBRARY_PATH *
def respawn_in_path(lib_path, pybind_path, pythonlib_path, asan_lib_path):
execv_cmd = []
if 'CEPH_DBG' in os.environ:
- execv_cmd += ['@PYTHON_EXECUTABLE@', '-mpdb']
+ execv_cmd += ['@PYTHON3_EXECUTABLE@', '-mpdb']
if platform.system() == "Darwin":
lib_path_var = "DYLD_LIBRARY_PATH"
@@ -0,0 +1,76 @@
diff --git a/src/include/blobhash.h b/src/include/blobhash.h
index 597884e4c9..97f2065ce3 100644
--- a/src/include/blobhash.h
+++ b/src/include/blobhash.h
@@ -14,33 +14,40 @@
#ifndef CEPH_BLOBHASH_H
#define CEPH_BLOBHASH_H
+#include <cstdint>
#include "hash.h"
-/*
-- this is to make some of the STL types work with 64 bit values, string hash keys, etc.
-- added when i was using an old STL.. maybe try taking these out and see if things
- compile now?
-*/
-
class blobhash {
public:
- uint32_t operator()(const char *p, unsigned len) {
- static rjhash<uint32_t> H;
- uint32_t acc = 0;
+ uint32_t operator()(const void* p, size_t len) {
+ static rjhash<std::uint32_t> H;
+ std::uint32_t acc = 0;
+ auto buf = static_cast<const unsigned char*>(p);
while (len >= sizeof(acc)) {
- acc ^= *(uint32_t*)p;
- p += sizeof(uint32_t);
- len -= sizeof(uint32_t);
+ acc ^= unaligned_load(buf);
+ buf += sizeof(std::uint32_t);
+ len -= sizeof(std::uint32_t);
}
- int sh = 0;
- while (len) {
- acc ^= (uint32_t)*p << sh;
- sh += 8;
- len--;
- p++;
+ // handle the last few bytes of p[-(len % 4):]
+ switch (len) {
+ case 3:
+ acc ^= buf[2] << 16;
+ [[fallthrough]];
+ case 2:
+ acc ^= buf[1] << 8;
+ [[fallthrough]];
+ case 1:
+ acc ^= buf[0];
+ [[fallthrough]];
}
return H(acc);
}
+private:
+ static inline std::uint32_t unaligned_load(const unsigned char* p) {
+ std::uint32_t result;
+ __builtin_memcpy(&result, p, sizeof(result));
+ return result;
+ }
};
diff --git a/src/msg/msg_types.h b/src/msg/msg_types.h
index b6952ca498..576b7d6b8a 100644
--- a/src/msg/msg_types.h
+++ b/src/msg/msg_types.h
@@ -566,7 +566,7 @@ namespace std {
size_t operator()( const entity_addr_t& x ) const
{
static blobhash H;
- return H((const char*)&x, sizeof(x));
+ return H(&x, sizeof(x));
}
};
} // namespace std