]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: nit fixes
authorOr Ozeri <oro@il.ibm.com>
Thu, 24 Dec 2020 09:39:09 +0000 (11:39 +0200)
committerOr Ozeri <oro@il.ibm.com>
Tue, 5 Jan 2021 18:27:30 +0000 (20:27 +0200)
This commit includes very small miscellaneous changes to librbd

Signed-off-by: Or Ozeri <oro@il.ibm.com>
src/librbd/crypto/CryptoObjectDispatch.cc
src/librbd/io/ObjectRequest.cc
src/test/librbd/crypto/test_mock_CryptoObjectDispatch.cc

index d61c73afbdc82400910eec4dc41965cdfdbac8f9..5f6df63d88a0c6b6c314457519eaf726fd8bc675 100644 (file)
@@ -70,12 +70,13 @@ struct C_AlignedObjectReadRequest : public Context {
     }
 
     void finish(int r) override {
+      ldout(image_ctx->cct, 20) << "aligned read r=" << r << dendl;
       on_finish->complete(r);
     }
 
     void handle_read(int r) {
       auto cct = image_ctx->cct;
-      ldout(cct, 20) << "r=" << r << dendl;
+      ldout(cct, 20) << "aligned read r=" << r << dendl;
       if (r == 0) {
         for (auto& extent: *extents) {
           auto crypto_ret = crypto->decrypt_aligned_extent(
@@ -171,7 +172,7 @@ struct C_UnalignedObjectReadRequest : public Context {
     }
 
     void finish(int r) override {
-      ldout(cct, 20) << "r=" << r << dendl;
+      ldout(cct, 20) << "unaligned read r=" << r << dendl;
       if (r >= 0) {
         remove_alignment_data();
 
@@ -342,7 +343,7 @@ struct C_UnalignedObjectWriteRequest : public Context {
     }
 
     void handle_read(int r) {
-      ldout(image_ctx->cct, 20) << "r=" << r << dendl;
+      ldout(image_ctx->cct, 20) << "unaligned write r=" << r << dendl;
 
       if (r == -ENOENT) {
         auto ctx = create_context_callback<
@@ -397,6 +398,7 @@ struct C_UnalignedObjectWriteRequest : public Context {
     }
 
     void handle_write(int r) {
+      ldout(image_ctx->cct, 20) << "r=" << r << dendl;
       bool exclusive = write_flags & io::OBJECT_WRITE_FLAG_CREATE_EXCLUSIVE;
       bool restart = false;
       if (r == -ERANGE && !assert_version.has_value()) {
@@ -413,6 +415,7 @@ struct C_UnalignedObjectWriteRequest : public Context {
     }
 
     void finish(int r) override {
+      ldout(image_ctx->cct, 20) << "unaligned write r=" << r << dendl;
       on_finish->complete(r);
     }
 };
index 00fea70d6093477492c625b49b7703471ca158f4..ed420a569250272f2b30ba833fa7d4d2c091b941 100644 (file)
@@ -258,6 +258,9 @@ template <typename I>
 void ObjectReadRequest<I>::handle_read_object(int r) {
   I *image_ctx = this->m_ictx;
   ldout(image_ctx->cct, 20) << "r=" << r << dendl;
+  if (m_version != nullptr) {
+    ldout(image_ctx->cct, 20) << "version=" << *m_version << dendl;
+  }
 
   if (r == -ENOENT) {
     read_parent();
index f3b9aef8340536f4a35d7d61ddf97811f68ea81b..2f6972217fdf0f5de6b2060a0f07752b1bbbf701 100644 (file)
@@ -387,7 +387,7 @@ TEST_F(TestMockCryptoCryptoObjectDispatch, UnalignedRead) {
   ASSERT_EQ(on_finish, &finished_cond);
   ASSERT_EQ(ETIMEDOUT, dispatched_cond.wait_for(0));
 
-  dispatcher_ctx->complete(0);
+  dispatcher_ctx->complete(4096*8);
   ASSERT_EQ(3 + 4096 * 5 - 2, dispatched_cond.wait());
   ASSERT_TRUE(extents[0].bl.to_str() == std::string("1"));
   ASSERT_TRUE(extents[1].bl.to_str() == std::string("2"));
@@ -431,7 +431,7 @@ TEST_F(TestMockCryptoCryptoObjectDispatch, UnalignedWrite) {
   auto expected_data =
           std::string("2") + std::string(8192, '1') + std::string(4095, '3');
   expect_object_write(0, expected_data, 0, std::make_optional(version));
-  dispatcher_ctx->complete(0); // complete read
+  dispatcher_ctx->complete(8192); // complete read
   ASSERT_EQ(ETIMEDOUT, dispatched_cond.wait_for(0));
   dispatcher_ctx->complete(0); // complete write
   ASSERT_EQ(0, dispatched_cond.wait());
@@ -492,7 +492,7 @@ TEST_F(TestMockCryptoCryptoObjectDispatch, UnalignedWriteFailCreate) {
   auto expected_data2 =
         std::string("2") + std::string(8192, '1') + std::string(4095, '3');
   expect_object_write(0, expected_data2, 0, std::make_optional(version));
-  dispatcher_ctx->complete(0); // complete read
+  dispatcher_ctx->complete(8192); // complete read
   ASSERT_EQ(ETIMEDOUT, dispatched_cond.wait_for(0));
   dispatcher_ctx->complete(0); // complete write
   ASSERT_EQ(0, dispatched_cond.wait());
@@ -537,7 +537,7 @@ TEST_F(TestMockCryptoCryptoObjectDispatch, UnalignedWriteCopyup) {
   auto expected_data =
         std::string("2") + std::string(8192, '1') + std::string(4095, '3');
   expect_object_write(0, expected_data, 0, std::make_optional(version));
-  dispatcher_ctx->complete(0); // complete second read
+  dispatcher_ctx->complete(8192); // complete second read
   ASSERT_EQ(ETIMEDOUT, dispatched_cond.wait_for(0));
   dispatcher_ctx->complete(0); // complete write
   ASSERT_EQ(0, dispatched_cond.wait());
@@ -561,7 +561,7 @@ TEST_F(TestMockCryptoCryptoObjectDispatch, UnalignedWriteFailVersionCheck) {
   auto expected_data =
           std::string("2") + std::string(8192, '1') + std::string(4095, '3');
   expect_object_write(0, expected_data, 0, std::make_optional(version));
-  dispatcher_ctx->complete(0); // complete read
+  dispatcher_ctx->complete(8192); // complete read
   ASSERT_EQ(ETIMEDOUT, dispatched_cond.wait_for(0));
 
   version = 1235;
@@ -572,7 +572,7 @@ TEST_F(TestMockCryptoCryptoObjectDispatch, UnalignedWriteFailVersionCheck) {
   ASSERT_EQ(ETIMEDOUT, dispatched_cond.wait_for(0));
 
   expect_object_write(0, expected_data, 0, std::make_optional(version));
-  dispatcher_ctx->complete(0); // complete read
+  dispatcher_ctx->complete(8192); // complete read
   ASSERT_EQ(ETIMEDOUT, dispatched_cond.wait_for(0));
   dispatcher_ctx->complete(0); // complete write
   ASSERT_EQ(0, dispatched_cond.wait());
@@ -594,7 +594,7 @@ TEST_F(TestMockCryptoCryptoObjectDispatch, UnalignedWriteWithAssertVersion) {
   ASSERT_EQ(dispatch_result, io::DISPATCH_RESULT_COMPLETE);
   ASSERT_EQ(on_finish, &finished_cond);
 
-  dispatcher_ctx->complete(0); // complete read
+  dispatcher_ctx->complete(8192); // complete read
   ASSERT_EQ(-ERANGE, dispatched_cond.wait());
 }
 
@@ -612,7 +612,7 @@ TEST_F(TestMockCryptoCryptoObjectDispatch, UnalignedWriteWithExclusiveCreate) {
   ASSERT_EQ(dispatch_result, io::DISPATCH_RESULT_COMPLETE);
   ASSERT_EQ(on_finish, &finished_cond);
 
-  dispatcher_ctx->complete(0); // complete read
+  dispatcher_ctx->complete(8192); // complete read
   ASSERT_EQ(-EEXIST, dispatched_cond.wait());
 }
 
@@ -638,7 +638,7 @@ TEST_F(TestMockCryptoCryptoObjectDispatch, CompareAndWrite) {
   auto expected_data =
           std::string("2") + std::string(8192, '1') + std::string(4095, '3');
   expect_object_write(0, expected_data, 0, std::make_optional(version));
-  dispatcher_ctx->complete(0); // complete read
+  dispatcher_ctx->complete(4096*4); // complete read
   ASSERT_EQ(ETIMEDOUT, dispatched_cond.wait_for(0));
   dispatcher_ctx->complete(0); // complete write
   ASSERT_EQ(0, dispatched_cond.wait());
@@ -664,7 +664,7 @@ TEST_F(TestMockCryptoCryptoObjectDispatch, CompareAndWriteFail) {
   ASSERT_EQ(dispatch_result, io::DISPATCH_RESULT_COMPLETE);
   ASSERT_EQ(on_finish, &finished_cond);
 
-  dispatcher_ctx->complete(0); // complete read
+  dispatcher_ctx->complete(4096*4); // complete read
   ASSERT_EQ(-EILSEQ, dispatched_cond.wait());
   ASSERT_EQ(mismatch_offset, 4094);
 }