]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore: fake paddr is only possible with UT, wrap with UNIT_TESTS_BUILT
authorYingxin Cheng <yingxin.cheng@intel.com>
Wed, 23 Apr 2025 09:02:54 +0000 (17:02 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Fri, 25 Apr 2025 01:20:34 +0000 (09:20 +0800)
Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/crimson/os/seastore/cache.cc
src/crimson/os/seastore/extent_placement_manager.h
src/crimson/os/seastore/transaction.h

index 12681a44912a8ebfdc9126457e1834255f268531..43715f34c1482cc5269cedd439796799e457a445 100644 (file)
@@ -1408,7 +1408,11 @@ record_t Cache::prepare_record(
     fresh_stat.increment(i->get_length());
     get_by_ext(efforts.fresh_inline_by_ext,
                i->get_type()).increment(i->get_length());
+#ifdef UNIT_TESTS_BUILT
     assert(i->is_inline() || i->get_paddr().is_fake());
+#else
+    assert(i->is_inline());
+#endif
 
     bufferlist bl;
     i->prepare_write();
index 4ff9729c5f4402d526778579a24b3890cddf3991..709c46d968c680262d3f2218aa47327119bb6374 100644 (file)
@@ -558,9 +558,11 @@ public:
 
   bool get_checksum_needed(paddr_t addr) {
     // checksum offloading only for blocks physically stored in the device
+#ifdef UNIT_TESTS_BUILT
     if (addr.is_fake()) {
       return true;
     }
+#endif
     assert(addr.is_absolute());
     return !devices_by_id[addr.get_device_id()]->is_end_to_end_data_protection();
   }
index 9de630daa90a0221df510becc41165a23a304e0d..84320e5bb33a4a5728d96b0625855780771848d2 100644 (file)
@@ -188,11 +188,16 @@ public:
       pre_alloc_list.emplace_back(ref);
       fresh_block_stats.increment(ref->get_length());
     } else {
+#ifdef UNIT_TESTS_BUILT
       if (likely(ref->get_paddr() == make_record_relative_paddr(0))) {
        ref->set_paddr(make_record_relative_paddr(offset));
       } else {
        ceph_assert(ref->get_paddr().is_fake());
       }
+#else
+      assert(ref->get_paddr() == make_record_relative_paddr(0));
+      ref->set_paddr(make_record_relative_paddr(offset));
+#endif
       offset += ref->get_length();
       inline_block_list.push_back(ref);
       fresh_block_stats.increment(ref->get_length());