offset,
length,
ref->get_bptr()).safe_then(
- [ref=std::move(ref)]() mutable {
+ [this, ref=std::move(ref)]() mutable {
ref->on_clean_read();
ref->complete_io();
+ add_extent(ref);
return get_extent_ertr::make_ready_future<TCachedExtentRef<T>>(
std::move(ref));
},
ASSERT_TRUE(ret);
addr = extent->get_paddr();
}
+ {
+ // test that consecutive reads on the same extent get the same ref
+ auto t = get_transaction();
+ auto extent = cache.get_extent<CacheTestBlock>(
+ *t,
+ addr,
+ CacheTestBlock::SIZE).unsafe_get0();
+ auto t2 = get_transaction();
+ auto extent2 = cache.get_extent<CacheTestBlock>(
+ *t2,
+ addr,
+ CacheTestBlock::SIZE).unsafe_get0();
+ ASSERT_EQ(&*extent, &*extent2);
+ }
{
// read back test block
auto t = get_transaction();