summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/librbd/cache/ParentCacheObjectDispatch.cc4
-rw-r--r--src/librbd/cache/ParentCacheObjectDispatch.h24
-rw-r--r--src/test/librbd/cache/test_mock_ParentImageCache.cc15
3 files changed, 22 insertions, 21 deletions
diff --git a/src/librbd/cache/ParentCacheObjectDispatch.cc b/src/librbd/cache/ParentCacheObjectDispatch.cc
index daa1c1f707f..c2c772b3a1f 100644
--- a/src/librbd/cache/ParentCacheObjectDispatch.cc
+++ b/src/librbd/cache/ParentCacheObjectDispatch.cc
@@ -20,6 +20,7 @@
<< this << " " << __func__ << ": "
using namespace ceph::immutable_obj_cache;
+using librbd::util::data_object_name;
namespace librbd {
namespace cache {
@@ -63,7 +64,7 @@ void ParentCacheObjectDispatch<I>::init() {
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,
@@ -73,6 +74,7 @@ bool ParentCacheObjectDispatch<I>::read(
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.*/
diff --git a/src/librbd/cache/ParentCacheObjectDispatch.h b/src/librbd/cache/ParentCacheObjectDispatch.h
index 4bacc278645..20a81fb0501 100644
--- a/src/librbd/cache/ParentCacheObjectDispatch.h
+++ b/src/librbd/cache/ParentCacheObjectDispatch.h
@@ -5,7 +5,6 @@
#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"
@@ -41,16 +40,16 @@ public:
}
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) {
@@ -58,8 +57,8 @@ public:
}
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) {
@@ -67,9 +66,9 @@ public:
}
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) {
@@ -77,9 +76,8 @@ public:
}
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,
diff --git a/src/test/librbd/cache/test_mock_ParentImageCache.cc b/src/test/librbd/cache/test_mock_ParentImageCache.cc
index fe6482d6020..9f4f0cb4da0 100644
--- a/src/test/librbd/cache/test_mock_ParentImageCache.cc
+++ b/src/test/librbd/cache/test_mock_ParentImageCache.cc
@@ -271,17 +271,18 @@ TEST_F(TestMockParentImageCache, test_disble_interface) {
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);
@@ -332,7 +333,7 @@ TEST_F(TestMockParentImageCache, test_read) {
.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());