New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rbd: support rbd on FreeBSD (without KRBD) #12798
Conversation
2a6ed91
to
2f6a2aa
Compare
Hi I'm getting this casting error in Clang that doesn't want to go away, with any of the casting version, other than static_cast. I hope you have some suggestions.
|
@wjwithagen i will take a look at it tomorrow. |
Probably it is due to NULL usuage on: But as usual I'm not able to fix it. nullptr/NULL is not quite my thing. |
2f6a2aa
to
37c909e
Compare
rbd_types | ||
rbd_replay_types) | ||
if(WITH_KRBD) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you squash this commit into 6022d01 ?
${CMAKE_DL_LIBS} | ||
${EXTRALIBS}) | ||
if(HAVE_UDEV) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might want to remove udev from the linked libraries of librbd. as krbd links against it already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tchaikov
To start it should use the define for that:
./cmake/modules/Findudev.cmake:23:# UDEV_LIBRARIES - List of libraries when using udev.
But I feel uncomfortable removing it, since it was already there, and I try to change as little functionality as possible when adding FreeBSD/Clang specifics.
Old behaviour should be kept as much as possible for all others.
That said, you are right: librbd add udev.
I'll make a separate PR for that, and rebase this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I try to change as little functionality as possible when adding FreeBSD/Clang specifics.
i agree, but behaviorwise, removing libudev here does not change anything.
I'll make a separate PR for that, and rebase this one.
thanks.
endif() | ||
if(HAVE_UDEV) | ||
target_link_libraries(ceph_test_cls_rbd | ||
udev) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could just remove blkid and udev from ceph_test_cls_rbd's linked libraries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tchaikov
Yup, like above
@@ -233,6 +233,9 @@ option(WITH_KVS "Key value store is here" ON) | |||
# remote block storage | |||
option(WITH_RBD "Remote block storage is here" ON) | |||
|
|||
# KERNEL remote block storage | |||
option(WITH_KRBD "Kernel Remote block storage is here" ON) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should send out a FATAL_ERROR
message if WITH_KRBD=ON
and WITH_RBD=OFF
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tchaikov
I'll add some diganostics
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not addressed.
@@ -38,6 +38,9 @@ | |||
#undef ENODATA | |||
#define ENODATA ENOATTR | |||
#endif | |||
#ifndef EREMOTEIO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you consolidate this #define
with the ones at line:79. so there is only one place that we define EREMOTEIO
and HOST_NAME_MAX
. also instead of HOST_NAME_MAX
, FreeBSD has MAXHOSTNAMELEN
. maybe we can define HOST_NAME_MAX
like
#ifndef HOST_NAME_MAX
# ifdef MAXHOSTNAMELEN)
# define HOST_NAME_MAX MAXHOSTNAMELEN
# else
# define HOST_NAME_MAX 64
# endif
#endif
BTW, 64 is a very conservative number. probably we can make it 255.
@@ -163,6 +163,7 @@ static int parse_unmap_options(char *options) | |||
|
|||
static int do_kernel_showmapped(Formatter *f) | |||
{ | |||
#if defined(__linux__) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably you can just ignore Kernel.cc
and Nbd.cc
in rbd_srcs
in src/tools/rbd/CMakeLists.txt
if !WITH_KRBD
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tchaikov
I'm leaving this in for the moment, because I would like to not change the run-cli tests.
And that expects showmapped map unmap
in the help output.
So for met that would make this the most transparent fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense. it's non-trivial to conditionalize the run-cli tests, i guess.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it be based on WITH_KRBD
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wjwithagen could you add WITH_KRBD
to config-h.in.cmake
and conditionalize on it instead?
@@ -25,7 +25,11 @@ ACTION_P(CopyInBufferlist, str) { | |||
} | |||
|
|||
ACTION_P2(CompleteContext, r, wq) { | |||
#if defined(__clang__) | |||
ContextWQ *context_wq = static_cast<ContextWQ *>(wq); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
although this is a little bit awkward, but this is the best we can have with minimal change, otherwise we need to change some of the callers of CompleteContext
to cast the NULL
parameter to the ContextWQ *
.
@dillaman what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm --- it's pretty ugly so I might vote for just using a C-style cast if Clang doesn't like it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... do you have any details on the compile failure? The only way I can see this failing is if somehow wq
auto-resolved to nullptr_t
, but nothing that I can find is passing in nullptr
(unless Clang is somehow substituting nullptr
for NULL
-- which is wrong since they are not the same)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dillaman @tchaikov
This is the full output of the build error when I use the original cast:
Building CXX object src/test/librbd/CMakeFiles/unittest_librbd.dir/test_mock_Journal.cc.o
cd /usr/srcs/Ceph/work/ceph/build/src/test/librbd && ccache /usr/bin/CC -DCEPH_LIBDIR=\"/usr/local/lib\" -DCEPH_PKGLIBDIR=\"/usr/local/lib/ceph\" -DTEST_LIBRBD_INTERNALS -I/usr/srcs/Ceph/work/ceph/build/src/include -I/usr/srcs/Ceph/work/ceph/src -isystem /usr/local/include -isystem /usr/srcs/Ceph/work/ceph/build/include -I/usr/srcs/Ceph/work/ceph/src/xxHash -I/usr/srcs/Ceph/work/ceph/src/googletest/googlemock/include -I/usr/srcs/Ceph/work/ceph/src/googletest/googletest/include -Wall -Wtype-limits -Wignored-qualifiers -Winit-self -Wpointer-arith -Werror=format-security -fno-strict-aliasing -fsigned-char -Wno-unused-function -Wno-unused-local-typedef -Wno-varargs -Wno-gnu-designator -Wno-missing-braces -Wno-parentheses -Wno-deprecated-register -ftemplate-depth-1024 -Wno-invalid-offsetof -Wnon-virtual-dtor -Wno-inconsistent-missing-override -Wno-mismatched-tags -Wno-unused-private-field -fdiagnostics-color=auto -I/usr/local/include/nss/nss -I/usr/local/include/nspr -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -Wno-null-dereference -O0 -g -fPIE -DHAVE_CONFIG_H -D__CEPH__ -D_REENTRANT -D_THREAD_SAFE -D__STDC_FORMAT_MACROS -I/usr/srcs/Ceph/work/ceph/src/googletest/googlemock/include -I/usr/srcs/Ceph/work/ceph/build/src/googletest/googlemock/include -I/usr/srcs/Ceph/work/ceph/src/googletest/googletest/include -I/usr/srcs/Ceph/work/ceph/build/src/googletest/googletest/include -fno-strict-aliasing -std=c++11 -o CMakeFiles/unittest_librbd.dir/test_mock_Journal.cc.o -c /usr/srcs/Ceph/work/ceph/src/test/librbd/test_mock_Journal.cc
In file included from /usr/srcs/Ceph/work/ceph/src/test/librbd/test_mock_Journal.cc:4:
/usr/srcs/Ceph/work/ceph/src/test/librbd/test_mock_fixture.h:31:27: error: reinterpret_cast from 'nullptr_t' to 'ContextWQ *' is not allowed
ContextWQ *context_wq = reinterpret_cast<ContextWQ *>(wq);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/srcs/Ceph/work/ceph/src/googletest/googlemock/include/gmock/gmock-generated-actions.h:523:27: note: in instantiation of function template specialization 'CompleteContextActionP2<int, nullptr_t>::gmock_Impl<void (Context *)>::gmock_PerformImpl<Context *, testing::internal::ExcessiveArg, testing::internal::ExcessiveArg, testing::internal::ExcessiveArg, testing::internal::ExcessiveArg, testing::internal::ExcessiveArg, testing::internal::ExcessiveArg, testing::internal::ExcessiveArg, testing::internal::ExcessiveArg, testing::internal::ExcessiveArg>' requested here
return impl->template gmock_PerformImpl<A0>(args, get<0>(args),
^
/usr/srcs/Ceph/work/ceph/src/test/librbd/test_mock_fixture.h:27:1: note: in instantiation of function template specialization 'testing::internal::ActionHelper<void, CompleteContextActionP2<int, nullptr_t>::gmock_Impl<void (Context *)> >::Perform<Context *>' requested here
ACTION_P2(CompleteContext, r, wq) {
^
/usr/srcs/Ceph/work/ceph/src/googletest/googlemock/include/gmock/gmock-generated-actions.h:1420:13: note: expanded from macro 'ACTION_P2'
Perform(this, args);\
^
/usr/srcs/Ceph/work/ceph/src/test/librbd/test_mock_fixture.h:27:1: note: in instantiation of member function 'CompleteContextActionP2<int, nullptr_t>::gmock_Impl<void (Context *)>::Perform' requested here
/usr/srcs/Ceph/work/ceph/src/googletest/googlemock/include/gmock/gmock-generated-actions.h:1416:7: note: expanded from macro 'ACTION_P2'
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), \
^
/usr/srcs/Ceph/work/ceph/src/test/librbd/test_mock_fixture.h:27:1: note: in instantiation of member function 'CompleteContextActionP2<int, nullptr_t>::gmock_Impl<void (Context *)>::gmock_Impl' requested here
/usr/srcs/Ceph/work/ceph/src/googletest/googlemock/include/gmock/gmock-generated-actions.h:1436:39: note: expanded from macro 'ACTION_P2'
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1));\
^
/usr/srcs/Ceph/work/ceph/src/test/librbd/test_mock_Journal.cc:268:29: note: in instantiation of function template specialization 'CompleteContextActionP2<int, nullptr_t>::operator Action<void (Context *)>' requested here
.WillOnce(CompleteContext(0, NULL));
^
1 error generated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dillaman
Not quite.....
A nicer sollution might be to actually fix the typecaset for NULL
:
CompleteContext(r, static_cast<ContextWQ *>(NULL))
That works for both FreeBSD/Clang and linux/GCC.
Need to fix that in about 8 locations.
Could do that in a separate PR and drop this commit from this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's fine as well -- long term would still need a Clang compiler in the Jenkins build set to ensure future PRs don't break things
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dillaman
And it needs to be running with a environment where NULL is defined to be nullptr !!
Will submit a PR tomorrow. It is past midnight here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, that's also what i suggested in the beginning. as NULL
could also be defined as 0
where static_cast<>()
does not work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tchaikov |
37c909e
to
382117e
Compare
#define HOST_NAME_MAX 255 | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see #12798 (comment), could use MAXHOSTNAMELEN
instead hardwire HOST_NAME_MAX
to 255.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and could move the #endif /* __APPLE__ */
before #ifndef EREMOTEIO
and change it to #endif
.
7861936
to
d917dfb
Compare
@wjwithagen needs rebase. |
d917dfb
to
6150774
Compare
@tchaikov |
option(WITH_KRBD "Kernel Remote block storage is here" ON) | ||
|
||
if(WITH_KRBD AND !WITH_RBD) | ||
message(FATAL_ERROR "Cannot have WITH_KRBD with WITH_RBD.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/with/without/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tchaikov
Every day something new to learn.... ;-)
@@ -163,6 +163,7 @@ static int parse_unmap_options(char *options) | |||
|
|||
static int do_kernel_showmapped(Formatter *f) | |||
{ | |||
#if defined(__linux__) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wjwithagen could you add WITH_KRBD
to config-h.in.cmake
and conditionalize on it instead?
6150774
to
fb38fac
Compare
@tchaikov |
fb38fac
to
3ebd88a
Compare
Signed-off-by: Willem Jan Withagen <wjw@digiware.nl>
Signed-off-by: Willem Jan Withagen <wjw@digiware.nl>
Signed-off-by: Willem Jan Withagen <wjw@digiware.nl>
- and combined some FreeBSD defines with Apple's Signed-off-by: Willem Jan Withagen <wjw@digiware.nl>
Signed-off-by: Willem Jan Withagen <wjw@digiware.nl>
Signed-off-by: Willem Jan Withagen <wjw@digiware.nl>
…c_cast is sufficient Signed-off-by: Willem Jan Withagen <wjw@digiware.nl>
Signed-off-by: Willem Jan Withagen <wjw@digiware.nl>
3ebd88a
to
f12c8eb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Cmake changes to exclude KRBD and keyutils from building because FreeBSD does not support that.
Code changes to:
Signed-off-by: Willem Jan Withagen wjw@digiware.nl