From: Samuel Just Date: Mon, 1 Jun 2020 19:01:40 +0000 (-0700) Subject: crimson/os/seastore/cache: add read clean extents to cache X-Git-Tag: v16.1.0~2167^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=39071ae75a6a9db8c2366790de74a3e80152d198;p=ceph.git crimson/os/seastore/cache: add read clean extents to cache Signed-off-by: Samuel Just --- diff --git a/src/crimson/os/seastore/cache.h b/src/crimson/os/seastore/cache.h index 043f9ae09123..7f511217d10d 100644 --- a/src/crimson/os/seastore/cache.h +++ b/src/crimson/os/seastore/cache.h @@ -195,9 +195,10 @@ public: 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>( std::move(ref)); }, diff --git a/src/test/crimson/seastore/test_seastore_cache.cc b/src/test/crimson/seastore/test_seastore_cache.cc index d6ecd83435e1..797d080e194f 100644 --- a/src/test/crimson/seastore/test_seastore_cache.cc +++ b/src/test/crimson/seastore/test_seastore_cache.cc @@ -189,6 +189,20 @@ TEST_F(cache_test_t, test_dirty_extent) 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( + *t, + addr, + CacheTestBlock::SIZE).unsafe_get0(); + auto t2 = get_transaction(); + auto extent2 = cache.get_extent( + *t2, + addr, + CacheTestBlock::SIZE).unsafe_get0(); + ASSERT_EQ(&*extent, &*extent2); + } { // read back test block auto t = get_transaction();