]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test/crimson/seastore/test_object_data_handler: always access object 60655/head
authorXuehan Xu <xuxuehan@qianxin.com>
Fri, 8 Nov 2024 04:55:27 +0000 (12:55 +0800)
committerXuehan Xu <xuxuehan@qianxin.com>
Mon, 11 Nov 2024 08:46:15 +0000 (16:46 +0800)
data based on offsets relative to the start of the object data base

Signed-off-by: Xuehan Xu <xuxuehan@qianxin.com>
src/test/crimson/seastore/test_object_data_handler.cc

index e7aabf2c8af87d914201199d8fcb17e7670be91c..5dbc3748e5b9351ec950bbc62a7b0225c8eadafb 100644 (file)
@@ -218,14 +218,20 @@ struct object_data_handler_test_t:
     objaddr_t offset,
     extent_len_t length) {
     auto ret = with_trans_intr(t, [&](auto &t) {
-      return tm->get_pins(t, laddr_t::from_byte_offset(offset), length);
+      auto &layout = onode->get_layout();
+      auto odata = layout.object_data.get();
+      auto obase = odata.get_reserved_data_base();
+      return tm->get_pins(t, (obase + offset).checked_to_laddr(), length);
     }).unsafe_get();
     return ret;
   }
   std::list<LBAMappingRef> get_mappings(objaddr_t offset, extent_len_t length) {
     auto t = create_mutate_transaction();
     auto ret = with_trans_intr(*t, [&](auto &t) {
-      return tm->get_pins(t, laddr_t::from_byte_offset(offset), length);
+      auto &layout = onode->get_layout();
+      auto odata = layout.object_data.get();
+      auto obase = odata.get_reserved_data_base();
+      return tm->get_pins(t, (obase + offset).checked_to_laddr(), length);
     }).unsafe_get();
     return ret;
   }
@@ -253,12 +259,16 @@ struct object_data_handler_test_t:
 
   ObjectDataBlockRef get_extent(
     Transaction &t,
-    laddr_t addr,
+    loffset_t addr,
     extent_len_t len) {
+    auto &layout = onode->get_layout();
+    auto odata = layout.object_data.get();
+    auto obase = odata.get_reserved_data_base();
     auto ext = with_trans_intr(t, [&](auto& trans) {
-       return tm->read_extent<ObjectDataBlock>(trans, addr, len);
-       }).unsafe_get();
-    EXPECT_EQ(addr, ext->get_laddr());
+      return tm->read_extent<ObjectDataBlock>(
+       trans, (obase + addr).checked_to_laddr(), len);
+    }).unsafe_get();
+    EXPECT_EQ((obase + addr).checked_to_laddr(), ext->get_laddr());
     return ext;
   }
 
@@ -798,7 +808,7 @@ TEST_P(object_data_handler_test_t, overwrite_then_read_within_transaction) {
       auto pins = get_mappings(*t, base, len);
       assert(pins.size() == 1);
       auto pin1 = remap_pin(*t, std::move(pins.front()), 4096, 8192);
-      auto ext = get_extent(*t, laddr_t::from_byte_offset(base + 4096), 4096 * 2);
+      auto ext = get_extent(*t, base + 4096, 4096 * 2);
       ASSERT_TRUE(ext->is_exist_clean());
       write(*t, base + 4096, 4096, 'y');
       ASSERT_TRUE(ext->is_exist_mutation_pending());