<< this << " " << __func__ << ": "
using namespace ceph::immutable_obj_cache;
+using librbd::util::data_object_name;
namespace librbd {
namespace cache {
template <typename I>
bool ParentCacheObjectDispatch<I>::read(
- const std::string &oid, uint64_t object_no, uint64_t object_off,
+ uint64_t object_no, uint64_t object_off,
uint64_t object_len, librados::snap_t snap_id, int op_flags,
const ZTracer::Trace &parent_trace, ceph::bufferlist* read_data,
io::ExtentMap* extent_map, int* object_dispatch_flags,
ldout(cct, 20) << "object_no=" << object_no << " " << object_off << "~"
<< object_len << dendl;
ceph_assert(m_initialized);
+ string oid = data_object_name(m_image_ctx, object_no);
/* if RO daemon still don't startup, or RO daemon crash,
* or session have any error, try to re-connect daemon.*/
#define CEPH_LIBRBD_CACHE_PARENT_CACHER_OBJECT_DISPATCH_H
#include "common/Mutex.h"
-//#include "SharedPersistentObjectCacher.h"
#include "librbd/io/ObjectDispatchInterface.h"
#include "tools/immutable_object_cache/CacheClient.h"
#include "librbd/cache/TypeTraits.h"
}
bool read(
- const std::string &oid, uint64_t object_no, uint64_t object_off,
- uint64_t object_len, librados::snap_t snap_id, int op_flags,
+ uint64_t object_no, uint64_t object_off, uint64_t object_len,
+ librados::snap_t snap_id, int op_flags,
const ZTracer::Trace &parent_trace, ceph::bufferlist* read_data,
io::ExtentMap* extent_map, int* object_dispatch_flags,
io::DispatchResult* dispatch_result, Context** on_finish,
Context* on_dispatched) override;
bool discard(
- const std::string &oid, uint64_t object_no, uint64_t object_off,
- uint64_t object_len, const ::SnapContext &snapc, int discard_flags,
+ uint64_t object_no, uint64_t object_off, uint64_t object_len,
+ const ::SnapContext &snapc, int discard_flags,
const ZTracer::Trace &parent_trace, int* object_dispatch_flags,
uint64_t* journal_tid, io::DispatchResult* dispatch_result,
Context** on_finish, Context* on_dispatched) {
}
bool write(
- const std::string &oid, uint64_t object_no, uint64_t object_off,
- ceph::bufferlist&& data, const ::SnapContext &snapc, int op_flags,
+ uint64_t object_no, uint64_t object_off, ceph::bufferlist&& data,
+ const ::SnapContext &snapc, int op_flags,
const ZTracer::Trace &parent_trace, int* object_dispatch_flags,
uint64_t* journal_tid, io::DispatchResult* dispatch_result,
Context** on_finish, Context* on_dispatched) {
}
bool write_same(
- const std::string &oid, uint64_t object_no, uint64_t object_off,
- uint64_t object_len, io::Extents&& buffer_extents,
- ceph::bufferlist&& data, const ::SnapContext &snapc, int op_flags,
+ uint64_t object_no, uint64_t object_off, uint64_t object_len,
+ io::LightweightBufferExtents&& buffer_extents, ceph::bufferlist&& data,
+ const ::SnapContext &snapc, int op_flags,
const ZTracer::Trace &parent_trace, int* object_dispatch_flags,
uint64_t* journal_tid, io::DispatchResult* dispatch_result,
Context** on_finish, Context* on_dispatched) {
}
bool compare_and_write(
- const std::string &oid, uint64_t object_no, uint64_t object_off,
- ceph::bufferlist&& cmp_data, ceph::bufferlist&& write_data,
- const ::SnapContext &snapc, int op_flags,
+ uint64_t object_no, uint64_t object_off, ceph::bufferlist&& cmp_data,
+ ceph::bufferlist&& write_data, const ::SnapContext &snapc, int op_flags,
const ZTracer::Trace &parent_trace, uint64_t* mismatch_offset,
int* object_dispatch_flags, uint64_t* journal_tid,
io::DispatchResult* dispatch_result, Context** on_finish,
Context* temp_on_dispatched = nullptr;
ZTracer::Trace* temp_trace = nullptr;
io::FlushSource temp_flush_source;
+ io::LightweightBufferExtents buffer_extents;
- ASSERT_EQ(mock_parent_image_cache->discard(temp_oid, 0, 0, 0, *temp_snapc, 0, *temp_trace, temp_op_flags,
+ ASSERT_EQ(mock_parent_image_cache->discard(0, 0, 0, *temp_snapc, 0, *temp_trace, temp_op_flags,
temp_journal_tid, temp_dispatch_result, temp_on_finish, temp_on_dispatched), false);
- ASSERT_EQ(mock_parent_image_cache->write(temp_oid, 0, 0, std::move(temp_bl), *temp_snapc, 0,
- *temp_trace, temp_op_flags, temp_journal_tid, temp_dispatch_result,
+ ASSERT_EQ(mock_parent_image_cache->write(0, 0, std::move(temp_bl), *temp_snapc, 0,
+ *temp_trace, temp_op_flags, temp_journal_tid, temp_dispatch_result,
temp_on_finish, temp_on_dispatched), false);
- ASSERT_EQ(mock_parent_image_cache->write_same(temp_oid, 0, 0, 0, std::move(temp_buffer_extents),
+ ASSERT_EQ(mock_parent_image_cache->write_same(0, 0, 0, std::move(buffer_extents),
std::move(temp_bl), *temp_snapc, 0, *temp_trace, temp_op_flags,
temp_journal_tid, temp_dispatch_result, temp_on_finish, temp_on_dispatched), false );
- ASSERT_EQ(mock_parent_image_cache->compare_and_write(temp_oid, 0, 0, std::move(temp_bl), std::move(temp_bl),
- *temp_snapc, 0, *temp_trace, temp_journal_tid, temp_op_flags, temp_journal_tid,
+ ASSERT_EQ(mock_parent_image_cache->compare_and_write(0, 0, std::move(temp_bl), std::move(temp_bl),
+ *temp_snapc, 0, *temp_trace, temp_journal_tid, temp_op_flags, temp_journal_tid,
temp_dispatch_result, temp_on_finish, temp_on_dispatched), false);
ASSERT_EQ(mock_parent_image_cache->flush(temp_flush_source, *temp_trace, temp_journal_tid,
temp_dispatch_result, temp_on_finish, temp_on_dispatched), false);
.WillOnce(Return(true));
expect_cache_lookup_object(*mock_parent_image_cache, on_finish);
- mock_parent_image_cache->read(ictx->get_object_name(0), 0, 0, 4096, CEPH_NOSNAP, 0, {},
+ mock_parent_image_cache->read(0, 0, 4096, CEPH_NOSNAP, 0, {},
nullptr, nullptr, nullptr, nullptr, &on_finish, nullptr);
ASSERT_EQ(0, cond.wait());