Merge pull request #7197 from ceph/wip-kill-warnings

build: fix warnings

Reviewed-by: Sage Weil <sage@redhat.com>
Reviewed-by: Greg Farnum <gfarnum@redhat.com>
This commit is contained in:
Sage Weil 2016-01-20 18:16:55 -05:00
commit 222488a5e2
12 changed files with 131 additions and 70 deletions

View File

@ -454,11 +454,6 @@ AC_ARG_WITH([profiler],
AS_IF([test "x$with_profiler" = xyes],
[AC_CHECK_LIB([profiler], [ProfilerFlush], [],
[AC_MSG_FAILURE([--with-profiler was given but libprofiler (libgoogle-perftools-dev on debian) not found])])
AC_LANG_PUSH([C++])
AC_CHECK_HEADERS([gperftools/heap-profiler.h \
gperftools/malloc_extension.h \
gperftools/profiler.h])
AC_LANG_POP([C++])
],
[])
AM_CONDITIONAL(WITH_PROFILER, test "$with_profiler" = "yes")
@ -591,6 +586,15 @@ AS_IF([test "x$with_tcmalloc" != xno],
[no tcmalloc found (use --without-tcmalloc to disable)])])])
AM_CONDITIONAL(WITH_TCMALLOC, [test "$HAVE_LIBTCMALLOC" = "1"])
AS_IF([test "$with_profiler" = yes -o \
"$HAVE_LIBTCMALLOC" = "1" -o \
"$HAVE_LIBTCMALLOC_MINIMAL" = "1"],
[AC_LANG_PUSH([C++])
AC_CHECK_HEADERS([gperftools/heap-profiler.h \
gperftools/malloc_extension.h \
gperftools/profiler.h])
AC_LANG_POP([C++])])
# error out if --with-jemalloc and ! --without-tcmalloc
if test "x$with_jemalloc" = "xyes"; then
if test "x$with_tcmalloc" != "xno"; then

View File

@ -60,17 +60,18 @@ isa_sources = \
erasure-code/isa/ErasureCodePluginIsa.cc: ./ceph_ver.h
libec_isa_la_SOURCES = ${isa_sources}
noinst_LTLIBRARIES += libisa.la
libisa_la_SOURCES = ${isa_sources}
libisa_la_CFLAGS = ${AM_CFLAGS} -I $(srcdir)/erasure-code/isa/isa-l/include/
libisa_la_CXXFLAGS = ${AM_CXXFLAGS}
libisa_la_CCASFLAGS = ${AM_CCASFLAGS} -I $(srcdir)/erasure-code/isa/isa-l/include/
libisa_la_LIBTOOLFLAGS = --tag=CC
libec_isa_la_CFLAGS = ${AM_CFLAGS} -I $(srcdir)/erasure-code/isa/isa-l/include/
libec_isa_la_CXXFLAGS = ${AM_CXXFLAGS} -I $(srcdir)/erasure-code/isa/isa-l/include/
libec_isa_la_CCASFLAGS = ${AM_CCASFLAGS} -I $(abs_srcdir)/erasure-code/isa/isa-l/include/
libec_isa_la_LIBADD = $(LIBCRUSH) $(PTHREAD_LIBS) $(EXTRALIBS)
libec_isa_la_SOURCES =
libec_isa_la_LIBADD = libisa.la $(LIBCRUSH) $(PTHREAD_LIBS) $(EXTRALIBS)
libec_isa_la_LDFLAGS = ${AM_LDFLAGS} -module -avoid-version -shared
if LINUX
libec_isa_la_LDFLAGS += -export-symbols-regex '.*__erasure_code_.*'
endif
libec_isa_la_LIBTOOLFLAGS = --tag=CC
erasure_codelib_LTLIBRARIES += libec_isa.la

View File

@ -456,7 +456,8 @@ int RocksDBStore::split_key(rocksdb::Slice in, string *prefix, string *key)
void RocksDBStore::compact()
{
logger->inc(l_rocksdb_compact);
db->CompactRange(NULL, NULL);
rocksdb::CompactRangeOptions options;
db->CompactRange(options, nullptr, nullptr);
}
@ -529,9 +530,10 @@ bool RocksDBStore::check_omap_dir(string &omap_dir)
}
void RocksDBStore::compact_range(const string& start, const string& end)
{
rocksdb::Slice cstart(start);
rocksdb::Slice cend(end);
db->CompactRange(&cstart, &cend);
rocksdb::CompactRangeOptions options;
rocksdb::Slice cstart(start);
rocksdb::Slice cend(end);
db->CompactRange(options, &cstart, &cend);
}
RocksDBStore::RocksDBWholeSpaceIteratorImpl::~RocksDBWholeSpaceIteratorImpl()
{

View File

@ -3186,10 +3186,13 @@ extern "C" int rados_ioctx_pool_requires_alignment2(rados_ioctx_t io,
{
tracepoint(librados, rados_ioctx_pool_requires_alignment_enter2, io);
librados::IoCtxImpl *ctx = (librados::IoCtxImpl *)io;
bool requires_alignment;
int retval = ctx->client->pool_requires_alignment2(ctx->get_id(),
(bool *)requires);
&requires_alignment);
tracepoint(librados, rados_ioctx_pool_requires_alignment_exit2, retval,
*requires);
requires_alignment);
if (requires)
*requires = requires_alignment;
return retval;
}

View File

@ -703,7 +703,7 @@ int BlueFS::_read(
int ret = 0;
while (len > 0) {
int left;
size_t left;
if (off < buf->bl_off || off >= buf->get_buf_end()) {
buf->bl.clear();
buf->bl_off = off & super.block_mask();

View File

@ -162,7 +162,7 @@ unittest_erasure_code_isa_SOURCES = \
erasure-code/ErasureCode.cc \
test/erasure-code/TestErasureCodeIsa.cc
unittest_erasure_code_isa_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS}
unittest_erasure_code_isa_LDADD = $(LIBOSD) $(LIBCOMMON) $(UNITTEST_LDADD) $(CEPH_GLOBAL) .libs/libec_isa.la $(LIBERASURE_CODE)
unittest_erasure_code_isa_LDADD = $(LIBOSD) $(LIBCOMMON) $(UNITTEST_LDADD) $(CEPH_GLOBAL) libisa.la $(LIBERASURE_CODE)
if LINUX
unittest_erasure_code_isa_LDADD += -ldl
endif
@ -172,7 +172,7 @@ unittest_erasure_code_plugin_isa_SOURCES = \
erasure-code/ErasureCode.cc \
test/erasure-code/TestErasureCodePluginIsa.cc
unittest_erasure_code_plugin_isa_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS}
unittest_erasure_code_plugin_isa_LDADD = $(LIBOSD) $(LIBCOMMON) $(UNITTEST_LDADD) $(CEPH_GLOBAL) .libs/libec_isa.la $(LIBERASURE_CODE)
unittest_erasure_code_plugin_isa_LDADD = $(LIBOSD) $(LIBCOMMON) $(UNITTEST_LDADD) $(CEPH_GLOBAL) $(LIBERASURE_CODE)
if LINUX
unittest_erasure_code_plugin_isa_LDADD += -ldl
endif

View File

@ -25,7 +25,9 @@ void RadosTestNS::SetUp()
{
cluster = RadosTestNS::s_cluster;
ASSERT_EQ(0, rados_ioctx_create(cluster, pool_name.c_str(), &ioctx));
ASSERT_FALSE(rados_ioctx_pool_requires_alignment(ioctx));
int requires;
ASSERT_EQ(0, rados_ioctx_pool_requires_alignment2(ioctx, &requires));
ASSERT_FALSE(requires);
}
void RadosTestNS::TearDown()
@ -71,7 +73,9 @@ void RadosTestPPNS::TearDownTestCase()
void RadosTestPPNS::SetUp()
{
ASSERT_EQ(0, cluster.ioctx_create(pool_name.c_str(), ioctx));
ASSERT_FALSE(ioctx.pool_requires_alignment());
bool requires;
ASSERT_EQ(0, ioctx.pool_requires_alignment2(&requires));
ASSERT_FALSE(requires);
}
void RadosTestPPNS::TearDown()
@ -151,7 +155,9 @@ void RadosTestParamPPNS::SetUp()
}
ASSERT_EQ(0, cluster.ioctx_create(pool_name.c_str(), ioctx));
ASSERT_FALSE(ioctx.pool_requires_alignment());
bool requires;
ASSERT_EQ(0, ioctx.pool_requires_alignment2(&requires));
ASSERT_FALSE(requires);
}
void RadosTestParamPPNS::TearDown()
@ -191,9 +197,11 @@ void RadosTestECNS::SetUp()
{
cluster = RadosTestECNS::s_cluster;
ASSERT_EQ(0, rados_ioctx_create(cluster, pool_name.c_str(), &ioctx));
ASSERT_TRUE(rados_ioctx_pool_requires_alignment(ioctx));
alignment = rados_ioctx_pool_required_alignment(ioctx);
ASSERT_NE((unsigned)0, alignment);
int requires;
ASSERT_EQ(0, rados_ioctx_pool_requires_alignment2(ioctx, &requires));
ASSERT_TRUE(requires);
ASSERT_EQ(0, rados_ioctx_pool_required_alignment2(ioctx, &alignment));
ASSERT_NE(0U, alignment);
}
void RadosTestECNS::TearDown()
@ -219,9 +227,11 @@ void RadosTestECPPNS::TearDownTestCase()
void RadosTestECPPNS::SetUp()
{
ASSERT_EQ(0, cluster.ioctx_create(pool_name.c_str(), ioctx));
ASSERT_TRUE(ioctx.pool_requires_alignment());
alignment = ioctx.pool_required_alignment();
ASSERT_NE((unsigned)0, alignment);
bool requires;
ASSERT_EQ(0, ioctx.pool_requires_alignment2(&requires));
ASSERT_TRUE(requires);
ASSERT_EQ(0, ioctx.pool_required_alignment2(&alignment));
ASSERT_NE(0U, alignment);
}
void RadosTestECPPNS::TearDown()
@ -250,7 +260,9 @@ void RadosTest::SetUp()
ASSERT_EQ(0, rados_ioctx_create(cluster, pool_name.c_str(), &ioctx));
nspace = get_temp_pool_name();
rados_ioctx_set_namespace(ioctx, nspace.c_str());
ASSERT_FALSE(rados_ioctx_pool_requires_alignment(ioctx));
int requires;
ASSERT_EQ(0, rados_ioctx_pool_requires_alignment2(ioctx, &requires));
ASSERT_FALSE(requires);
}
void RadosTest::TearDown()
@ -303,7 +315,9 @@ void RadosTestPP::SetUp()
ASSERT_EQ(0, cluster.ioctx_create(pool_name.c_str(), ioctx));
nspace = get_temp_pool_name();
ioctx.set_namespace(nspace);
ASSERT_FALSE(ioctx.pool_requires_alignment());
bool requires;
ASSERT_EQ(0, ioctx.pool_requires_alignment2(&requires));
ASSERT_FALSE(requires);
}
void RadosTestPP::TearDown()
@ -398,7 +412,9 @@ void RadosTestParamPP::SetUp()
ASSERT_EQ(0, cluster.ioctx_create(pool_name.c_str(), ioctx));
nspace = get_temp_pool_name();
ioctx.set_namespace(nspace);
ASSERT_FALSE(ioctx.pool_requires_alignment());
bool requires;
ASSERT_EQ(0, ioctx.pool_requires_alignment2(&requires));
ASSERT_FALSE(requires);
}
void RadosTestParamPP::TearDown()
@ -446,9 +462,11 @@ void RadosTestEC::SetUp()
ASSERT_EQ(0, rados_ioctx_create(cluster, pool_name.c_str(), &ioctx));
nspace = get_temp_pool_name();
rados_ioctx_set_namespace(ioctx, nspace.c_str());
ASSERT_TRUE(rados_ioctx_pool_requires_alignment(ioctx));
alignment = rados_ioctx_pool_required_alignment(ioctx);
ASSERT_NE((unsigned)0, alignment);
int requires;
ASSERT_EQ(0, rados_ioctx_pool_requires_alignment2(ioctx, &requires));
ASSERT_TRUE(requires);
ASSERT_EQ(0, rados_ioctx_pool_required_alignment2(ioctx, &alignment));
ASSERT_NE(0U, alignment);
}
void RadosTestEC::TearDown()
@ -477,9 +495,11 @@ void RadosTestECPP::SetUp()
ASSERT_EQ(0, cluster.ioctx_create(pool_name.c_str(), ioctx));
nspace = get_temp_pool_name();
ioctx.set_namespace(nspace);
ASSERT_TRUE(ioctx.pool_requires_alignment());
alignment = ioctx.pool_required_alignment();
ASSERT_NE((unsigned)0, alignment);
bool requires;
ASSERT_EQ(0, ioctx.pool_requires_alignment2(&requires));
ASSERT_TRUE(requires);
ASSERT_EQ(0, ioctx.pool_required_alignment2(&alignment));
ASSERT_NE(0U, alignment);
}
void RadosTestECPP::TearDown()

View File

@ -2208,9 +2208,12 @@ TEST(LibRadosAioEC, RoundTripAppend) {
ASSERT_EQ("", test_data.init());
ASSERT_EQ(0, rados_aio_create_completion((void*)&test_data,
set_completion_completeEC, set_completion_safeEC, &my_completion));
ASSERT_TRUE(rados_ioctx_pool_requires_alignment(test_data.m_ioctx));
uint64_t alignment = rados_ioctx_pool_required_alignment(test_data.m_ioctx);
ASSERT_NE((unsigned)0, alignment);
int requires;
ASSERT_EQ(0, rados_ioctx_pool_requires_alignment2(test_data.m_ioctx, &requires));
ASSERT_NE(0, requires);
uint64_t alignment;
ASSERT_EQ(0, rados_ioctx_pool_required_alignment2(test_data.m_ioctx, &alignment));
ASSERT_NE(0U, alignment);
int bsize = alignment;
char *buf = (char *)new char[bsize];
@ -2276,8 +2279,11 @@ TEST(LibRadosAioEC, RoundTripAppendPP) {
(void*)&test_data, set_completion_completeEC, set_completion_safeEC);
AioCompletion *my_completion_null = NULL;
ASSERT_NE(my_completion, my_completion_null);
ASSERT_TRUE(test_data.m_ioctx.pool_requires_alignment());
uint64_t alignment = test_data.m_ioctx.pool_required_alignment();
bool requires;
ASSERT_EQ(0, test_data.m_ioctx.pool_requires_alignment2(&requires));
ASSERT_TRUE(requires);
uint64_t alignment;
ASSERT_EQ(0, test_data.m_ioctx.pool_required_alignment2(&alignment));
ASSERT_NE((unsigned)0, alignment);
int bsize = alignment;
char *buf = (char *)new char[bsize];

View File

@ -1397,12 +1397,12 @@ dowrite(unsigned offset, unsigned size)
(debug &&
(monitorstart == -1 ||
(offset + size > monitorstart &&
(monitorend == -1 || offset <= monitorend))))))
(monitorend == -1 || (long)offset <= monitorend))))))
prt("%lu write\t0x%x thru\t0x%x\t(0x%x bytes)\n", testcalls,
offset, offset + size - 1, size);
ret = ops->write(&ctx, offset, size, good_buf + offset);
if (ret != size) {
if (ret != (ssize_t)size) {
if (ret < 0)
prterrcode("dowrite: ops->write", ret);
else
@ -1442,7 +1442,7 @@ dotruncate(unsigned size)
if ((progressinterval && testcalls % progressinterval == 0) ||
(debug && (monitorstart == -1 || monitorend == -1 ||
size <= monitorend)))
(long)size <= monitorend)))
prt("%lu trunc\tfrom 0x%x to 0x%x\n", testcalls, oldsize, size);
ret = ops->resize(&ctx, size);
@ -1485,7 +1485,7 @@ do_punch_hole(unsigned offset, unsigned length)
if ((progressinterval && testcalls % progressinterval == 0) ||
(debug && (monitorstart == -1 || monitorend == -1 ||
end_offset <= monitorend))) {
(long)end_offset <= monitorend))) {
prt("%lu punch\tfrom 0x%x to 0x%x, (0x%x bytes)\n", testcalls,
offset, offset+length, length);
}

View File

@ -756,10 +756,18 @@ public:
uint64_t prev_length = found && old_value.has_contents() ?
old_value.most_recent_gen()->get_length(old_value.most_recent()) :
0;
bool requires;
int r = context->io_ctx.pool_requires_alignment2(&requires);
assert(r == 0);
uint64_t alignment = 0;
if (requires) {
r = context->io_ctx.pool_required_alignment2(&alignment);
assert(r == 0);
assert(alignment != 0);
}
cont_gen = new AppendGenerator(
prev_length,
(context->io_ctx.pool_requires_alignment() ?
context->io_ctx.pool_required_alignment() : 0),
alignment,
context->min_stride_size,
context->max_stride_size,
3);

View File

@ -19,6 +19,9 @@ static void ipv6(struct sockaddr_in6 *addr, const char *s) {
ASSERT_EQ(1, err);
}
static char eth0[] = "eth0";
static char eth1[] = "eth1";
TEST(CommonIPAddr, TestNotFound)
{
struct ifaddrs one, two;
@ -29,11 +32,11 @@ TEST(CommonIPAddr, TestNotFound)
one.ifa_next = &two;
one.ifa_addr = (struct sockaddr*)&a_one;
one.ifa_name = "eth0";
one.ifa_name = eth0;
two.ifa_next = NULL;
two.ifa_addr = (struct sockaddr*)&a_two;
two.ifa_name = "eth1";
two.ifa_name = eth1;
ipv4(&a_one, "10.11.12.13");
ipv6(&a_two, "2001:1234:5678:90ab::cdef");
@ -53,11 +56,11 @@ TEST(CommonIPAddr, TestV4_Simple)
one.ifa_next = &two;
one.ifa_addr = (struct sockaddr*)&a_one;
one.ifa_name = "eth0";
one.ifa_name = eth0;
two.ifa_next = NULL;
two.ifa_addr = (struct sockaddr*)&a_two;
two.ifa_name = "eth1";
two.ifa_name = eth1;
ipv4(&a_one, "10.11.12.13");
ipv6(&a_two, "2001:1234:5678:90ab::cdef");
@ -77,11 +80,11 @@ TEST(CommonIPAddr, TestV4_Prefix25)
one.ifa_next = &two;
one.ifa_addr = (struct sockaddr*)&a_one;
one.ifa_name = "eth0";
one.ifa_name = eth0;
two.ifa_next = NULL;
two.ifa_addr = (struct sockaddr*)&a_two;
two.ifa_name = "eth1";
two.ifa_name = eth1;
ipv4(&a_one, "10.11.12.13");
ipv4(&a_two, "10.11.12.129");
@ -101,11 +104,11 @@ TEST(CommonIPAddr, TestV4_Prefix16)
one.ifa_next = &two;
one.ifa_addr = (struct sockaddr*)&a_one;
one.ifa_name = "eth0";
one.ifa_name = eth0;
two.ifa_next = NULL;
two.ifa_addr = (struct sockaddr*)&a_two;
two.ifa_name = "eth1";
two.ifa_name = eth1;
ipv4(&a_one, "10.1.1.2");
ipv4(&a_two, "10.2.1.123");
@ -124,7 +127,7 @@ TEST(CommonIPAddr, TestV4_PrefixTooLong)
one.ifa_next = NULL;
one.ifa_addr = (struct sockaddr*)&a_one;
one.ifa_name = "eth0";
one.ifa_name = eth0;
ipv4(&a_one, "10.11.12.13");
ipv4(&net, "10.11.12.12");
@ -143,11 +146,11 @@ TEST(CommonIPAddr, TestV4_PrefixZero)
one.ifa_next = &two;
one.ifa_addr = (struct sockaddr*)&a_one;
one.ifa_name = "eth0";
one.ifa_name = eth0;
two.ifa_next = NULL;
two.ifa_addr = (struct sockaddr*)&a_two;
two.ifa_name = "eth1";
two.ifa_name = eth1;
ipv6(&a_one, "2001:1234:5678:900F::cdef");
ipv4(&a_two, "10.1.2.3");
@ -167,11 +170,11 @@ TEST(CommonIPAddr, TestV6_Simple)
one.ifa_next = &two;
one.ifa_addr = (struct sockaddr*)&a_one;
one.ifa_name = "eth0";
one.ifa_name = eth0;
two.ifa_next = NULL;
two.ifa_addr = (struct sockaddr*)&a_two;
two.ifa_name = "eth1";
two.ifa_name = eth1;
ipv4(&a_one, "10.11.12.13");
ipv6(&a_two, "2001:1234:5678:90ab::cdef");
@ -191,11 +194,11 @@ TEST(CommonIPAddr, TestV6_Prefix57)
one.ifa_next = &two;
one.ifa_addr = (struct sockaddr*)&a_one;
one.ifa_name = "eth0";
one.ifa_name = eth0;
two.ifa_next = NULL;
two.ifa_addr = (struct sockaddr*)&a_two;
two.ifa_name = "eth1";
two.ifa_name = eth1;
ipv6(&a_one, "2001:1234:5678:900F::cdef");
ipv6(&a_two, "2001:1234:5678:90ab::cdef");
@ -214,7 +217,7 @@ TEST(CommonIPAddr, TestV6_PrefixTooLong)
one.ifa_next = NULL;
one.ifa_addr = (struct sockaddr*)&a_one;
one.ifa_name = "eth0";
one.ifa_name = eth0;
ipv6(&a_one, "2001:1234:5678:900F::cdef");
ipv6(&net, "2001:1234:5678:900F::cdee");
@ -233,11 +236,11 @@ TEST(CommonIPAddr, TestV6_PrefixZero)
one.ifa_next = &two;
one.ifa_addr = (struct sockaddr*)&a_one;
one.ifa_name = "eth0";
one.ifa_name = eth0;
two.ifa_next = NULL;
two.ifa_addr = (struct sockaddr*)&a_two;
two.ifa_name = "eth1";
two.ifa_name = eth1;
ipv4(&a_one, "10.2.3.4");
ipv6(&a_two, "2001:f00b::1");

View File

@ -243,8 +243,22 @@ int RadosImport::get_object_rados(librados::IoCtx &ioctx, bufferlist &bl, bool n
need_align = true;
alignment = align;
} else {
if ((need_align = ioctx.pool_requires_alignment()))
alignment = ioctx.pool_required_alignment();
int ret = ioctx.pool_requires_alignment2(&need_align);
if (ret < 0) {
cerr << "pool_requires_alignment2 failed: " << cpp_strerror(ret)
<< std::endl;
return ret;
}
if (need_align) {
ret = ioctx.pool_required_alignment2(&alignment);
if (ret < 0) {
cerr << "pool_required_alignment2 failed: " << cpp_strerror(ret)
<< std::endl;
return ret;
}
assert(alignment != 0);
}
}
if (need_align) {