Repository navigation
crimson/os/seastore: make laddr_t block aligned - #59182
Conversation
|
jenkins test make check |
|
jenkins test make check |
cyx1231st
left a comment
There was a problem hiding this comment.
Still looking, thanks to split this into smaller PRs.
There was a problem hiding this comment.
Yes, the bottom of this file has one alias:
using laddr_interval_set_t = details::interval_set<laddr_t, extent_len_t>;There was a problem hiding this comment.
I think it's reasonable to decouple this PR from classic CI tests to accelerate merging.
The change looks general and reasonable -- probably we still need to drop the duplicated code -- can you send another PR to update the common interval_set and remove the crimson version after this?
There was a problem hiding this comment.
ok, this change will be extracted to a standalone PR.
There was a problem hiding this comment.
Might need your confirm that it is safe to assume the disk block size >= 4KiB since Crimson, because after this change, the extent laddr cannot support the alignment under 4KiB.
There was a problem hiding this comment.
Yeah, I'm fine with that. I can't think of a situation where we'd want to deal in smaller blocks.
cyx1231st
left a comment
There was a problem hiding this comment.
Might be enough comments to proceed.
The change of "make laddr_t block aligned" is foundamental, I'm still looking at it.
Let me know if any comment looks confusing.
|
I could not follow your comments about The The The point here is that the value of After the ObjectDataHandler finishing the construction of extents, the Of course we can make this cast explicit for soundness. For Seems C++ standard doesn't require the return value of |
Yeah, I think I get the idea, and I generally agree this direction is reasonable to introduce a combined type. There are some adjustment I think might be worthing for different reasons, though.
I didn't mean it is wrong, will elaborate in that thread. I'm not sure if you follow several comments around the encodable type Specifically, for example, at some time, we might want to optimize the width of A reasonable way might be to introduce a different uint64_t type (renamed as What do you think? |
I get it.
IIUC, there will be three types: struct laddr_t; // the logical address used in LogicalCachedExtent and LBAManager
using loffset_t = uint64_t; // the "distance" or "offset" across different extents
struct laddr_offset_t {
laddr_t base;
extent_len_t offset; // block not aligned part
};Here is one subtle thing that the // the difference between two laddrs usually works as byte distance,
// assume the result won't overflow and convert it into the byte
// addressing result automatically.
friend Int operator-(const laddr_t &l, const laddr_t &r) { // Int should be replaced with loffset_t
auto diff = l.value - r.value;
assert(diff <= (std::numeric_limits<Int>::max() >> UNIT_SHIFT));
return diff << UNIT_SHIFT;
}I found that most of subtraction between two laddr_t values actually happens within a single object, so I think it's safe to assume the difference won't overflow the loffset_t. The implementation of 128 laddr_t also has this problem. |
|
Seems most of comments are about the implicit conversion, I will remove them and repush |
|
I think one thing about subtraction of 128 laddr_t also needs to be noticed before opening the 128 laddr_t PR: To handle the different compilers and platforms, class laddr_t {
public:
// the type of underlying integer
#if defined (__SIZEOF_INT128__) && !TEST_SEASTORE_BOOST_U128_LADDR
using Int = unsigned __int128;
using MinusResultType = Int;
#else
using Int = boost::multiprecision::uint128_t;
// The boost version uint128_t doesn't downcast to shorter integer implicitly.
// Using MinusResultType as return type for the minus overloads could reduce
// explicit casts.
using MinusResultType = uint64_t;
#endif
friend MinusResultType operator-(const laddr_t &l, const laddr_t &r) {
auto diff = l.value - r.value;
assert(diff <= (std::numeric_limits<MinusResultType>::max() >> UNIT_SHIFT));
return static_cast<MinusResultType>(diff << UNIT_SHIFT);
}
}The boost uint128_t might use 24 bytes in some platforms. As the comments shows, the boost uint128 couldn't downcast to shorter integer and in consideration of the fact that the subtraction is not likely to overflow, here the What do you think about this approach, should we replace it to the explicit way? |
Yeah, I also think we won't calculate laddr difference larger than a uint64_t -- looks it is only used when related to the object data offset
Good to know! Is Probably we can introduce a basic version only with |
Currently there is no benchmark result, but I think the difference might not be significant.
I'd prefer the compiler intrinsics, because it works more like the integer primitive type and is simpler than boost u128, e.g. it's always 16 bytes, encode/decode via memcpy, boost uint128 should do some bitwise operations to get the low u64 value and the high u64 value. Since the boost u128 is implemented by the magic templates, it might cause some annoying compile errors sometimes. One example is: // NOTE: when using boost uint128 for laddr_t, considering such code:
//
// using u128 = boost::multiprecision::uint128_t;
// 1. static_assert(std::is_nothrow_move_constructible_v<const u128>, "");
// 2. static_assert(std::is_nothrow_move_constructible_v<const std::variant<int, u128>>, "");
// 3. static_assert(std::is_nothrow_move_constructible_v<const boost::variant<int, u128>>, "");
// 4. static_assert(std::is_nothrow_move_constructible_v<const boost::variant2::variant<int, u128>>, "");
//
// The result shows that assertion 2,3 fail so that pladdr_t is not nothrow move
// constructible. It seems that this is the restriction of std::variant.
// A workaround is to add noexcept declaration to make
// pladdr_t(std::variant<laddr_t, X>) nothrow move constructible, or use
// boost::variant2::variant instead.
pladdr_t(const pladdr_t &) noexcept = default;Anyway, both 128 int could work, |
I think it should be fine as long as it won't impact the denc size (16B).
Almost all the platforms are 64 bits (128-bit is mostly non native from CPU perspective), and taken that we only subtract laddrs for
OK, I suppose you mean that both versions will be implemented to make it platform compatible. |
This comment was marked as outdated.
This comment was marked as outdated.
I'm not sure whether there are further side-effects. Should be fine as long as the Ceph builds keep successful. |
It's guaranted.
It's no problem for |
It's just an illustration to show the difference between __int128 and boost uint128_t. |
Hm, I don't have a complete list of where Anyway, why not |
Because the
Ok, it's more like the explicit method, let's return the underlying |
|
Some changes:
|
|
jenkins test make check |
|
jenkins test api |
|
jenkins test make check |
cyx1231st
left a comment
There was a problem hiding this comment.
Still looking ..
Comments are mostly about type managements.
Signed-off-by: Zhang Song <[email protected]>
Use laddr_offset_t as parameter for ValueDeltaRecorder, since the payload offset may not be block aligned. Signed-off-by: Zhang Song <[email protected]>
|
jenkins test make check |
cyx1231st
left a comment
There was a problem hiding this comment.
Thanks to keep the commits well organized, LGTM!
(Looks there are some misuses of extent_len_t, though, but they are from existing code, unrelated to this PR).
|
To keep track ^: #59182 (comment) |
Somehow the block size doesn't match. |
…r than laddr_t::UNIT_SIZE Signed-off-by: Zhang Song <[email protected]>
|
jenkins test make check |
|
^ Only this PR is included on top of the main branch. Seems there are new unclassified failures (7877442, 7877443, 7877445), @zhscn @xxhdx1985126 can you also take a look? 7877438, 7877454-7 are know issues. 7877460 looks like infrastructure failure. I'll schedule a new run based on main to compare. |
|
7877442, 7877443 failed due to timeout:
|
|
https://pulpito.ceph.com/yingxin-2024-08-28_07:46:58-crimson-rados-wip-yingxin-testing-2024-08-28-1249-distro-default-smithi/7877445/ |
For 7877442 and 7877443, it seems that the osdmap handling of osdmap.236 never finished, as no later It seems that the continuation chain of Seems that Submitted a new issue for this: https://tracker.ceph.com/issues/67791 |
Also appears in https://pulpito.ceph.com/yingxin-2024-08-29_03:47:01-crimson-rados-wip-yingxin-testing-2024-08-28-1249-base-distro-default-smithi/ 7879716/7879717, should be unrelated to this PR. |
This is also reproduced in the main branch (with seastore), track as https://tracker.ceph.com/issues/67823 |
@xxhdx1985126 I renamed the title of issue for easier classification. |
This PR converts
laddr_tto a struct and make it block aligned, as the basic part of static 128-bits laddr design described at #55291 (comment) .Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins retest this pleasejenkins test classic perfjenkins test crimson perfjenkins test signedjenkins test make checkjenkins test make check arm64jenkins test submodulesjenkins test dashboardjenkins test dashboard cephadmjenkins test apijenkins test docsjenkins render docsjenkins test ceph-volume alljenkins test ceph-volume toxjenkins test windowsjenkins test rook e2e