]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test/librados_test_stub: pass snap context to zero op
authorMykola Golub <mgolub@mirantis.com>
Wed, 23 Aug 2017 07:46:42 +0000 (09:46 +0200)
committerJason Dillaman <dillaman@redhat.com>
Thu, 1 Feb 2018 16:16:25 +0000 (11:16 -0500)
Signed-off-by: Mykola Golub <mgolub@mirantis.com>
(cherry picked from commit 78ca0fde22076e8b156feb8dfd60aaee316a1895)

src/test/librados_test_stub/LibradosTestStub.cc
src/test/librados_test_stub/TestIoCtxImpl.h
src/test/librados_test_stub/TestMemIoCtxImpl.cc
src/test/librados_test_stub/TestMemIoCtxImpl.h

index 069f8e943b5209675867d7a1fbf9177c8e1e1c52..966ef1d1479874e3e52a3fa6d91506856311a692 100644 (file)
@@ -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<TestObjectOperationImpl*>(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) {
index 499a55f80f65a687a973473854bdffe9af2ee10b..3568cd3206d74d53e33b18f11ba94bf47db04575 100644 (file)
@@ -158,7 +158,8 @@ public:
                         std::map<std::string, bufferlist>* 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);
index cccbe820596317ec2c1aa139e1494b9d9fd60c5b..1ab891419facd9cb834a0f0e62c2d48215c7a153 100644 (file)
@@ -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) {
index c0f0c6f54556c5b3ec3210af263c0c9b7fd42f9e..e6082bbfa6935c451cca4db20d2be37c9e7bc728 100644 (file)
@@ -68,7 +68,8 @@ public:
                 std::map<std::string, bufferlist>* 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() {