From: Mykola Golub Date: Wed, 23 Aug 2017 07:46:42 +0000 (+0200) Subject: test/librados_test_stub: pass snap context to zero op X-Git-Tag: v13.0.0~31^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=78ca0fde22076e8b156feb8dfd60aaee316a1895;p=ceph.git test/librados_test_stub: pass snap context to zero op Signed-off-by: Mykola Golub --- diff --git a/src/test/librados_test_stub/LibradosTestStub.cc b/src/test/librados_test_stub/LibradosTestStub.cc index 069f8e943b52..966ef1d14798 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 499a55f80f65..3568cd3206d7 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 cccbe8205963..1ab891419fac 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 c0f0c6f54556..e6082bbfa693 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() {