@@ -331,12 +331,38 @@ struct omap_manager_test_t :
331331 EXPECT_EQ (omap_root.get_location (), L_ADDR_NULL);
332332 }
333333
334- void check_mappings (omap_root_t &omap_root, Transaction &t) {
334+ bool check_mappings_fastpath (omap_root_t &omap_root, Transaction &t) {
335+ auto config = OMapManager::omap_list_config_t ()
336+ .without_max ()
337+ .with_inclusive (true , true );
338+
339+ std::optional<std::string> null_key = std::nullopt ;
340+ auto [complete, omap_list] = with_trans_intr (t, [&, this ](auto &t) {
341+ return omap_manager->omap_list (
342+ omap_root, t, null_key, null_key, config); /* from start to end */
343+ }).unsafe_get ();
344+
345+ if (omap_list.size () != test_omap_mappings.size ()) { return false ; }
346+ return std::equal (test_omap_mappings.begin (),
347+ test_omap_mappings.end (),
348+ omap_list.begin (),
349+ [](const auto &a, const auto &b) {
350+ return a.first == b.first && a.second == b.second ;
351+ });
352+ }
353+
354+ void check_mappings_slowpath (omap_root_t &omap_root, Transaction &t) {
335355 for (const auto &i: test_omap_mappings){
336356 get_value (omap_root, t, i.first );
337357 }
338358 }
339359
360+ void check_mappings (omap_root_t &omap_root, Transaction &t) {
361+ if (!check_mappings_fastpath (omap_root, t)) {
362+ check_mappings_slowpath (omap_root, t);
363+ }
364+ }
365+
340366 void check_mappings (omap_root_t &omap_root) {
341367 auto t = create_read_transaction ();
342368 check_mappings (omap_root, *t);
0 commit comments