From 78ca0fde22076e8b156feb8dfd60aaee316a1895 Mon Sep 17 00:00:00 2001 From: Mykola Golub Date: Wed, 23 Aug 2017 09:46:42 +0200 Subject: [PATCH] test/librados_test_stub: pass snap context to zero op Signed-off-by: Mykola Golub --- src/test/librados_test_stub/LibradosTestStub.cc | 2 +- src/test/librados_test_stub/TestIoCtxImpl.h | 3 ++- src/test/librados_test_stub/TestMemIoCtxImpl.cc | 11 ++++++----- src/test/librados_test_stub/TestMemIoCtxImpl.h | 3 ++- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/test/librados_test_stub/LibradosTestStub.cc b/src/test/librados_test_stub/LibradosTestStub.cc index 069f8e943b520..966ef1d147987 100644 --- a/src/test/librados_test_stub/LibradosTestStub.cc +++ b/src/test/librados_test_stub/LibradosTestStub.cc @@ -920,7 +920,7 @@ void ObjectWriteOperation::writesame(uint64_t off, uint64_t len, const bufferlis void ObjectWriteOperation::zero(uint64_t off, uint64_t len) { TestObjectOperationImpl *o = reinterpret_cast(impl); - o->ops.push_back(boost::bind(&TestIoCtxImpl::zero, _1, _2, off, len)); + o->ops.push_back(boost::bind(&TestIoCtxImpl::zero, _1, _2, off, len, _4)); } Rados::Rados() : client(NULL) { diff --git a/src/test/librados_test_stub/TestIoCtxImpl.h b/src/test/librados_test_stub/TestIoCtxImpl.h index 499a55f80f65a..3568cd3206d74 100644 --- a/src/test/librados_test_stub/TestIoCtxImpl.h +++ b/src/test/librados_test_stub/TestIoCtxImpl.h @@ -158,7 +158,8 @@ public: std::map* attrset) = 0; virtual int xattr_set(const std::string& oid, const std::string &name, bufferlist& bl) = 0; - virtual int zero(const std::string& oid, uint64_t off, uint64_t len) = 0; + virtual int zero(const std::string& oid, uint64_t off, uint64_t len, + const SnapContext &snapc) = 0; int execute_operation(const std::string& oid, const Operation &operation); diff --git a/src/test/librados_test_stub/TestMemIoCtxImpl.cc b/src/test/librados_test_stub/TestMemIoCtxImpl.cc index cccbe82059631..1ab891419facd 100644 --- a/src/test/librados_test_stub/TestMemIoCtxImpl.cc +++ b/src/test/librados_test_stub/TestMemIoCtxImpl.cc @@ -657,7 +657,8 @@ int TestMemIoCtxImpl::xattr_set(const std::string& oid, const std::string &name, return 0; } -int TestMemIoCtxImpl::zero(const std::string& oid, uint64_t off, uint64_t len) { +int TestMemIoCtxImpl::zero(const std::string& oid, uint64_t off, uint64_t len, + const SnapContext &snapc) { if (m_client->is_blacklisted()) { return -EBLACKLISTED; } @@ -666,11 +667,11 @@ int TestMemIoCtxImpl::zero(const std::string& oid, uint64_t off, uint64_t len) { TestMemCluster::SharedFile file; { RWLock::WLocker l(m_pool->file_lock); - file = get_file(oid, false, get_snap_context()); + file = get_file(oid, false, snapc); if (!file) { return 0; } - file = get_file(oid, true, get_snap_context()); + file = get_file(oid, true, snapc); RWLock::RLocker l2(file->lock); if (len > 0 && off + len >= file->data.length()) { @@ -679,12 +680,12 @@ int TestMemIoCtxImpl::zero(const std::string& oid, uint64_t off, uint64_t len) { } } if (truncate_redirect) { - return truncate(oid, off, get_snap_context()); + return truncate(oid, off, snapc); } bufferlist bl; bl.append_zero(len); - return write(oid, bl, len, off, get_snap_context()); + return write(oid, bl, len, off, snapc); } void TestMemIoCtxImpl::append_clone(bufferlist& src, bufferlist* dest) { diff --git a/src/test/librados_test_stub/TestMemIoCtxImpl.h b/src/test/librados_test_stub/TestMemIoCtxImpl.h index c0f0c6f54556c..e6082bbfa6935 100644 --- a/src/test/librados_test_stub/TestMemIoCtxImpl.h +++ b/src/test/librados_test_stub/TestMemIoCtxImpl.h @@ -68,7 +68,8 @@ public: std::map* attrset) override; int xattr_set(const std::string& oid, const std::string &name, bufferlist& bl) override; - int zero(const std::string& oid, uint64_t off, uint64_t len) override; + int zero(const std::string& oid, uint64_t off, uint64_t len, + const SnapContext &snapc) override; protected: TestMemCluster::Pool *get_pool() { -- 2.39.5