From 5484020f6242853de883bcf1392fc14300dbed82 Mon Sep 17 00:00:00 2001 From: Xinyu Huang Date: Fri, 26 May 2023 11:05:08 +0000 Subject: [PATCH] test/crimson/seastore: test if lazy read work correctly Signed-off-by: Xinyu Huang (cherry picked from commit 9d973efe32c089351ec756232d3699b4c9fe1f64) --- .../seastore/test_transaction_manager.cc | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/src/test/crimson/seastore/test_transaction_manager.cc b/src/test/crimson/seastore/test_transaction_manager.cc index 82ec48829b1..d9e0ecad167 100644 --- a/src/test/crimson/seastore/test_transaction_manager.cc +++ b/src/test/crimson/seastore/test_transaction_manager.cc @@ -1895,6 +1895,48 @@ TEST_P(tm_single_device_test_t, find_hole_assert_trigger) }); } +TEST_P(tm_single_device_test_t, remap_lazy_read) +{ + constexpr laddr_t offset = 0; + constexpr size_t length = 256 << 10; + run_async([this, offset] { + { + auto t = create_transaction(); + auto extent = alloc_extent( + t, + offset, + length, + 'a'); + ASSERT_EQ(offset, extent->get_laddr()); + check_mappings(t); + submit_transaction(std::move(t)); + check(); + } + replay(); + { + auto t = create_transaction(); + auto pin = get_pin(t, offset); + auto rpin = remap_pin(t, std::move(pin), 0, 128 << 10); + check_mappings(t); + submit_transaction(std::move(t)); + check(); + } + replay(); + { + auto t = create_transaction(); + auto pin = get_pin(t, offset); + bufferlist bl; + bl.append(ceph::bufferptr(ceph::buffer::create(64 << 10, 0))); + auto [lpin, ext, rpin] = overwrite_pin( + t, std::move(pin), 4 << 10 , 64 << 10, bl); + check_mappings(t); + submit_transaction(std::move(t)); + check(); + } + replay(); + }); +} + TEST_P(tm_single_device_test_t, random_writes_concurrent) { test_random_writes_concurrent(); @@ -1919,18 +1961,22 @@ TEST_P(tm_single_device_test_t, test_remap_pin) { test_remap_pin(); } + TEST_P(tm_single_device_test_t, test_overwrite_pin) { test_overwrite_pin(); } + TEST_P(tm_single_device_test_t, test_remap_pin_concurrent) { test_remap_pin_concurrent(); } + TEST_P(tm_single_device_test_t, test_overwrite_pin_concurrent) { test_overwrite_pin_concurrent(); } + INSTANTIATE_TEST_SUITE_P( transaction_manager_test, tm_single_device_test_t, -- 2.39.5