MCPcopy Create free account
hub / github.com/ceph/ceph / write_same

Method write_same

src/librbd/crypto/CryptoObjectDispatch.cc:523–559  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

521
522template <typename I>
523bool CryptoObjectDispatch<I>::write_same(
524 uint64_t object_no, uint64_t object_off, uint64_t object_len,
525 io::LightweightBufferExtents&& buffer_extents, ceph::bufferlist&& data,
526 IOContext io_context, int op_flags,
527 const ZTracer::Trace &parent_trace, int* object_dispatch_flags,
528 uint64_t* journal_tid, io::DispatchResult* dispatch_result,
529 Context** on_finish, Context* on_dispatched) {
530 if (object_no < m_data_offset_object_no) {
531 return false;
532 }
533
534 auto cct = m_image_ctx->cct;
535 ldout(cct, 20) << data_object_name(m_image_ctx, object_no) << " "
536 << object_off << "~" << object_len << dendl;
537 ceph_assert(m_crypto != nullptr);
538
539 // convert to regular write
540 io::LightweightObjectExtent extent(object_no, object_off, object_len, 0);
541 extent.buffer_extents = std::move(buffer_extents);
542
543 bufferlist ws_data;
544 io::util::assemble_write_same_extent(extent, data, &ws_data, true);
545
546 auto ctx = new LambdaContext(
547 [on_finish_ctx=on_dispatched](int r) {
548 on_finish_ctx->complete(r);
549 });
550
551 *dispatch_result = io::DISPATCH_RESULT_COMPLETE;
552 auto req = io::ObjectDispatchSpec::create_write(
553 m_image_ctx,
554 io::util::get_previous_layer(io::OBJECT_DISPATCH_LAYER_CRYPTO),
555 object_no, object_off, std::move(ws_data), io_context, op_flags, 0,
556 std::nullopt, 0, parent_trace, ctx);
557 req->send();
558 return true;
559}
560
561template <typename I>
562bool CryptoObjectDispatch<I>::compare_and_write(

Callers

nothing calls this directly

Calls 5

data_object_nameFunction · 0.85
get_previous_layerFunction · 0.85
completeMethod · 0.45
sendMethod · 0.45

Tested by

no test coverage detected