| 485 | |
| 486 | template <typename I> |
| 487 | bool 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 | |
| 522 | template <typename I> |
| 523 | bool CryptoObjectDispatch<I>::write_same( |
nothing calls this directly
no test coverage detected