Repository navigation
crimson/os/seastore: OP_CLONERANGE2 support ---- another approach - #65134
Conversation
| } | ||
| return fut.discard_result().handle_error_interruptible( | ||
| ObjectDataHandler::write_iertr::pass_further{}, | ||
| crimson::ct_error::assert_all{"unexpected error"} |
There was a problem hiding this comment.
This could be a good opportunity to introduce new logic with coroutines, although we can probably address it later (If agreed to this approach).
However, I think we should try to avoid unexpected error messages in new code as they don't provide any information when debugging backtraces.
e.g 7207975
There was a problem hiding this comment.
Definitely +1 to coroutines.
There was a problem hiding this comment.
This could be a good opportunity to introduce new logic with coroutines, although we can probably address it later (If agreed to this approach). However, I think we should try to avoid
unexpected errormessages in new code as they don't provide any information when debugging backtraces. e.g 7207975
Yeah, will change to code:-)
athanatos
left a comment
There was a problem hiding this comment.
I think the concept is reasonable. I'd really like any new or heavily modified code to use coroutines -- makes the logic vastly more readable.
Question: needs_cow gets set on the target onode, right? So even the target of a small clone_range would have its entire lba range indirected in copy_on_write?
| context_t ctx, | ||
| object_data_t &object_data, | ||
| LBAMapping first_mapping) | ||
| { |
There was a problem hiding this comment.
At this point, I really want all new code to use coroutines if possible. Modifying code that uses explicit continuations with captures is exceedingly error prone.
| ObjectDataHandler::clone_ret | ||
| ObjectDataHandler::copy_on_write( | ||
| context_t ctx) | ||
| { |
There was a problem hiding this comment.
Again, coroutines. Probably also a coroutine appropriate replacement for with_object_data.
| ).si_then([ctx, this, &object_data](auto mapping) { | ||
| auto old_base = object_data.get_reserved_data_base(); | ||
| auto old_len = object_data.get_reserved_data_len(); | ||
| return do_clone(ctx, object_data, mapping |
There was a problem hiding this comment.
Is the result of this that the mappings for the onode become indirect?
| } | ||
| return fut.discard_result().handle_error_interruptible( | ||
| ObjectDataHandler::write_iertr::pass_further{}, | ||
| crimson::ct_error::assert_all{"unexpected error"} |
There was a problem hiding this comment.
Definitely +1 to coroutines.
| ctx, | ||
| object_data, | ||
| old_len | ||
| ).si_then([ctx, &object_data](auto mapping) { |
There was a problem hiding this comment.
Ok, so mapping is a mapping to a new reserved lba range for this object. The next part redirects that range to the old range completing the redirection. Is that right?
Yeah, will move to use coroutines.
I think we can optimize this in such a way that, when doing
With this approach, we can avoid making unnecessary indirections. What do you think? @athanatos @Matan-B |
Reasonable. Another question -- what happens if an object is the target of a clone many times? We need to reserve a max section of lba space each time, right? |
Do you mean what if a head object is issued with I think maybe we can set Are you concerned with the lba space exhaustion or the cpu overhead of the lba space reservation? |
@athanatos Hi, sam, I still don't quite understand the scenario you are considering, especially what you mean by being "the target of a clone many times". Could you please elaborate it a bit more?:-) |
31964d8 to
4f17bce
Compare
|
@athanatos @Matan-B I've just changed the implementation to be based on c++ coroutine as suggested, and added more comments to facilitate the review. Please take a look again, thanks:-) |
|
@athanatos I think I get your point. I've changed the code to always set I think, now, it's only when the recovering of some clone causes it to share the head object's direct lba mappings that the head will go through the |
After a second thought, maybe we can tolerate this case, as this is exactly the same as the result of a |
88b6eb1 to
1d7def4
Compare
|
|
I think this (non-trivial) PR should be separated from smaller ones when testing, what do you think? |
|
|
Sorry, I was running too many non-related alienstore test cases, here's the latest test: https://pulpito.ceph.com/xuxuehan-2025-09-18_08:01:34-crimson-rados-wip-seastore-clone-range-latest-distro-crimson-debug-smithi/ |
Failures: All failures seems unrelevant, will test it again, since some of the above issues have been resolved. |
the onode's object data space needs to do clone before modification At present, it's only when the onode's object data space is sharing its own direct lba mappings with other onodes that the "need_cow" field would be true. Signed-off-by: Xuehan Xu <[email protected]>
Signed-off-by: Xuehan Xu <[email protected]>
symmetric indirect lba relationship at the time of clone OP_CLONE is done in the following way: 1. First, swap the layout of the head onode and the clone onode, so that clone onode's object_data, omap_root, xattr_root and log_root all point to the head onode's corresponding fields; 2. Do SeaStore::_clone() from the clone onode to the head onode, which is exactly what rollback is done. This makes the code of ObjectDataHandler::clone() and ObjectDataHandler::copy_on_write() even simpler, and can facilitate the clone/rollback scenarios when the "128-bit" lba key layout is involved. Signed-off-by: Xuehan Xu <[email protected]>
Signed-off-by: Xuehan Xu <[email protected]>
needs it At present, only clone objects may need COW, as HEAD objects won't be sharing any direct lba mapping with other objects in non-recovery scenarios. Although the HEAD object may share its direct mappings with the temp object that's going to be recovered and replace it, it won't be accepting any modifications at that time. Signed-off-by: Xuehan Xu <[email protected]>
Signed-off-by: Xuehan Xu <[email protected]>
Signed-off-by: Xuehan Xu <[email protected]>
Signed-off-by: Xuehan Xu <[email protected]>
Signed-off-by: Xuehan Xu <[email protected]>
d642e61 to
a9fdbb7
Compare
|
@xxhdx1985126, Look related to me - the tracker mentioned isn't relevant here iiuc. Thrash test finished successfully but trimming has not. What do you think? |
Oh, I thought the test wouldn't wait for the trimming, sorry. |
|
athanatos
left a comment
There was a problem hiding this comment.
(Sorry! Meant to look at this last week but got side tracked) LGTM once you're happy with the tests.
All failures are confirmed. |
@xxhdx1985126, Most of the issues reported are now resolved and iiuc the PR is not rebased on top of them. The test results do look ok to me (!) - though I would prefer to re run the tests after rebasing on top of latest main + one of the fixes #65726. Note: It would be really interesting to enable seastore recovery test once this PR is merged as it was one of the blockers to enabling them. |
Please feel free to rerun the tests, thanks:-) |
This is another approach in implementing
OP_CLONERANGE2support in SeaStore than #57735 .Before this PR, we have implemented the support for
OP_CLONEandOP_CLONERANGE2in a way which requires maintaining strict symmetric indirect lba mapping relations at any time. This means we have to create two sets of indirect lba mappings when dealing withOP_CLONEand move the direct mapping out when dealing withOP_CLONERANGE2, which makes the mechanism ofcloneandclone_rangevery complex, error prone and inefficient in terms of performance.This PR takes another approach, which also ensures that modifications to any clone won't affect other clones that are sharing data with it, but doesn't require strict symmetric indirect lba mapping relations at any time, only at the time when those modifications actually happens.
Specifically, when dealing with
OP_CLONEandOP_CLONERANGE2, this PR record a boolean value,needs_cow, in the onode layout, and set it totrueif there's any direct lba mapping that's shared with other clones. When doing modifications to object data, we do another clone if the onode'sneeds_cowis true. With this approach, we only need to create one set of indirect lba mappings when dealing withOP_CLONEandOP_CLONERANGE2, and no direct lba mapping move is needed.Basically, this PR's approach is to implement a
COWmechinary of SeaStore itself and makes the mechanism behindOP_CLONEandOP_CLONERANGE2processing much simpler and more performant.Signed-off-by: Xuehan Xu [email protected]
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 test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job Definition