From: Samuel Just Date: Mon, 23 Aug 2021 20:51:50 +0000 (-0700) Subject: test/crimson/seastore/test_btree_lba_manager: add better merge test X-Git-Tag: v17.1.0~1003^2~10 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=4bbbfdd64ad2423ceb26be236e2e367959f98dfb;p=ceph.git test/crimson/seastore/test_btree_lba_manager: add better merge test Signed-off-by: Samuel Just --- diff --git a/src/test/crimson/seastore/test_btree_lba_manager.cc b/src/test/crimson/seastore/test_btree_lba_manager.cc index 144922969b8bf..3ea9abf02f032 100644 --- a/src/test/crimson/seastore/test_btree_lba_manager.cc +++ b/src/test/crimson/seastore/test_btree_lba_manager.cc @@ -116,12 +116,14 @@ struct btree_lba_manager_test : test_lba_mapping_t mappings; }; - auto create_transaction() { + auto create_transaction(bool create_fake_extent=true) { auto t = test_transaction_t{ cache.create_transaction(Transaction::src_t::MUTATE), test_lba_mappings }; - cache.alloc_new_extent(*t.t, TestBlockPhysical::SIZE); + if (create_fake_extent) { + cache.alloc_new_extent(*t.t, TestBlockPhysical::SIZE); + }; return t; } @@ -463,3 +465,40 @@ TEST_F(btree_lba_manager_test, single_transaction_split_merge) check_mappings(); }); } + +TEST_F(btree_lba_manager_test, split_merge_multi) +{ + run_async([this] { + auto iterate = [&](auto f) { + for (uint64_t i = 0; i < (1<<12); ++i) { + auto t = create_transaction(false); + logger().debug("opened transaction"); + for (unsigned j = 0; j < 5; ++j) { + f(t, (i * 5) + j); + } + logger().debug("submitting transaction"); + submit_test_transaction(std::move(t)); + } + }; + iterate([&](auto &t, auto idx) { + alloc_mapping(t, idx * block_size, block_size, get_paddr()); + }); + check_mappings(); + iterate([&](auto &t, auto idx) { + if ((idx % 32) > 0) { + decref_mapping(t, idx * block_size); + } + }); + check_mappings(); + iterate([&](auto &t, auto idx) { + if ((idx % 32) > 0) { + alloc_mapping(t, idx * block_size, block_size, get_paddr()); + } + }); + check_mappings(); + iterate([&](auto &t, auto idx) { + decref_mapping(t, idx * block_size); + }); + check_mappings(); + }); +}