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

Method write

src/librbd/crypto/CryptoObjectDispatch.cc:487–520  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

485
486template <typename I>
487bool CryptoObjectDispatch<I>::write(
488 uint64_t object_no, uint64_t object_off, ceph::bufferlist&& data,
489 IOContext io_context, int op_flags, int write_flags,
490 std::optional<uint64_t> assert_version,
491 const ZTracer::Trace &parent_trace, int* object_dispatch_flags,
492 uint64_t* journal_tid, io::DispatchResult* dispatch_result,
493 Context** on_finish, Context* on_dispatched) {
494 if (object_no < m_data_offset_object_no) {
495 return false;
496 }
497
498 auto cct = m_image_ctx->cct;
499 ldout(cct, 20) << data_object_name(m_image_ctx, object_no) << " "
500 << object_off << "~" << data.length() << dendl;
501 ceph_assert(m_crypto != nullptr);
502
503 if (m_crypto->is_aligned(object_off, data.length())) {
504 auto r = m_crypto->encrypt(
505 &data, get_file_offset(m_image_ctx, object_no, object_off));
506 *dispatch_result = r == 0 ? io::DISPATCH_RESULT_CONTINUE
507 : io::DISPATCH_RESULT_COMPLETE;
508 on_dispatched->complete(r);
509 } else {
510 *dispatch_result = io::DISPATCH_RESULT_COMPLETE;
511 auto req = new C_UnalignedObjectWriteRequest<I>(
512 m_image_ctx, m_crypto, object_no, object_off, std::move(data), {},
513 nullptr, io_context, op_flags, write_flags, assert_version,
514 parent_trace, object_dispatch_flags, journal_tid, on_dispatched,
515 true);
516 req->send();
517 }
518
519 return true;
520}
521
522template <typename I>
523bool CryptoObjectDispatch<I>::write_same(

Callers

nothing calls this directly

Calls 7

data_object_nameFunction · 0.85
get_file_offsetFunction · 0.70
lengthMethod · 0.45
is_alignedMethod · 0.45
encryptMethod · 0.45
completeMethod · 0.45
sendMethod · 0.45

Tested by

no test coverage detected