@@ -186,11 +186,6 @@ class Cache : public ExtentTransViewRetriever {
186186 return t.root ;
187187 }
188188
189- void account_absent_access (Transaction::src_t src) {
190- ++(get_by_src (stats.cache_absent_by_src , src));
191- ++stats.access .cache_absent ;
192- }
193-
194189 /* *
195190 * get_extent_if_cached
196191 *
@@ -208,7 +203,7 @@ class Cache : public ExtentTransViewRetriever {
208203 const auto t_src = t.get_src ();
209204 CachedExtentRef ret;
210205 auto result = t.get_extent (paddr, &ret);
211- extent_access_stats_t & access_stats = get_by_ext (
206+ cache_access_stats_t & access_stats = get_by_ext (
212207 get_by_src (stats.access_by_src_ext , t_src),
213208 type);
214209 if (result == Transaction::get_extent_ret::RETIRED) {
@@ -217,27 +212,28 @@ class Cache : public ExtentTransViewRetriever {
217212 t, type, paddr, len);
218213 return get_extent_if_cached_iertr::make_ready_future<CachedExtentRef>();
219214 } else if (result == Transaction::get_extent_ret::PRESENT) {
215+ if (ret->get_length () != len) {
216+ SUBDEBUGT (seastore_cache,
217+ " {} {}~0x{:x} is present on t with inconsistent length 0x{:x} -- {}" ,
218+ t, type, paddr, len, ret->get_length (), *ret);
219+ return get_extent_if_cached_iertr::make_ready_future<CachedExtentRef>();
220+ }
221+
222+ ceph_assert (ret->get_type () == type);
223+
220224 if (ret->is_stable ()) {
221225 if (ret->is_dirty ()) {
222226 ++access_stats.trans_dirty ;
223- ++stats.access .s . trans_dirty ;
227+ ++stats.access .trans_dirty ;
224228 } else {
225229 ++access_stats.trans_lru ;
226- ++stats.access .s . trans_lru ;
230+ ++stats.access .trans_lru ;
227231 }
228232 } else {
229233 ++access_stats.trans_pending ;
230- ++stats.access .s .trans_pending ;
231- }
232-
233- if (ret->get_length () != len) {
234- SUBDEBUGT (seastore_cache,
235- " {} {}~0x{:x} is present on t with inconsistent length 0x{:x} -- {}" ,
236- t, type, paddr, len, ret->get_length (), *ret);
237- return get_extent_if_cached_iertr::make_ready_future<CachedExtentRef>();
234+ ++stats.access .trans_pending ;
238235 }
239236
240- ceph_assert (ret->get_type () == type);
241237 if (!ret->is_fully_loaded ()) {
242238 SUBDEBUGT (seastore_cache,
243239 " {} {}~0x{:x} is present on t without fully loaded -- {}" ,
@@ -261,7 +257,6 @@ class Cache : public ExtentTransViewRetriever {
261257 SUBDEBUGT (seastore_cache,
262258 " {} {}~0x{:x} is absent in cache" ,
263259 t, type, paddr, len);
264- account_absent_access (t_src);
265260 return get_extent_if_cached_iertr::make_ready_future<CachedExtentRef>();
266261 }
267262
@@ -270,18 +265,9 @@ class Cache : public ExtentTransViewRetriever {
270265 SUBDEBUGT (seastore_cache,
271266 " {} {}~0x{:x} ~0x{:x} is absent(placeholder) in cache" ,
272267 t, type, paddr, len, ret->get_length ());
273- account_absent_access (t_src);
274268 return get_extent_if_cached_iertr::make_ready_future<CachedExtentRef>();
275269 }
276270
277- if (ret->is_dirty ()) {
278- ++access_stats.cache_dirty ;
279- ++stats.access .s .cache_dirty ;
280- } else {
281- ++access_stats.cache_lru ;
282- ++stats.access .s .cache_lru ;
283- }
284-
285271 if (ret->get_length () != len) {
286272 SUBDEBUGT (seastore_cache,
287273 " {} {}~0x{:x} is present in cache with inconsistent length 0x{:x} -- {}" ,
@@ -290,6 +276,15 @@ class Cache : public ExtentTransViewRetriever {
290276 }
291277
292278 ceph_assert (ret->get_type () == type);
279+
280+ if (ret->is_dirty ()) {
281+ ++access_stats.cache_dirty ;
282+ ++stats.access .cache_dirty ;
283+ } else {
284+ ++access_stats.cache_lru ;
285+ ++stats.access .cache_lru ;
286+ }
287+
293288 t.add_to_read_set (ret);
294289 touch_extent (*ret, &t_src, t.get_cache_hint ());
295290 if (!ret->is_fully_loaded ()) {
@@ -402,11 +397,11 @@ class Cache : public ExtentTransViewRetriever {
402397 // FIXME: assert(ext.is_stable_clean());
403398 assert (ext.is_stable ());
404399 assert (T::TYPE == ext.get_type ());
405- extent_access_stats_t & access_stats = get_by_ext (
400+ cache_access_stats_t & access_stats = get_by_ext (
406401 get_by_src (stats.access_by_src_ext , t_src),
407402 T::TYPE);
408403 ++access_stats.load_absent ;
409- ++stats.access .s . load_absent ;
404+ ++stats.access .load_absent ;
410405
411406 t.add_to_read_set (CachedExtentRef (&ext));
412407 touch_extent (ext, &t_src, t.get_cache_hint ());
@@ -475,7 +470,7 @@ class Cache : public ExtentTransViewRetriever {
475470
476471 const auto t_src = t.get_src ();
477472 auto ext_type = extent->get_type ();
478- extent_access_stats_t & access_stats = get_by_ext (
473+ cache_access_stats_t & access_stats = get_by_ext (
479474 get_by_src (stats.access_by_src_ext , t_src),
480475 ext_type);
481476
@@ -487,7 +482,7 @@ class Cache : public ExtentTransViewRetriever {
487482 assert (p_extent->is_pending_in_trans (t.get_trans_id ()));
488483 assert (!p_extent->is_stable_writting ());
489484 ++access_stats.trans_pending ;
490- ++stats.access .s . trans_pending ;
485+ ++stats.access .trans_pending ;
491486 if (p_extent->is_mutable ()) {
492487 assert (p_extent->is_fully_loaded ());
493488 assert (!p_extent->is_pending_io ());
@@ -502,27 +497,27 @@ class Cache : public ExtentTransViewRetriever {
502497 if (t.maybe_add_to_read_set (p_extent)) {
503498 if (p_extent->is_dirty ()) {
504499 ++access_stats.cache_dirty ;
505- ++stats.access .s . cache_dirty ;
500+ ++stats.access .cache_dirty ;
506501 } else {
507502 ++access_stats.cache_lru ;
508- ++stats.access .s . cache_lru ;
503+ ++stats.access .cache_lru ;
509504 }
510505 touch_extent (*p_extent, &t_src, t.get_cache_hint ());
511506 } else {
512507 if (p_extent->is_dirty ()) {
513508 ++access_stats.trans_dirty ;
514- ++stats.access .s . trans_dirty ;
509+ ++stats.access .trans_dirty ;
515510 } else {
516511 ++access_stats.trans_lru ;
517- ++stats.access .s . trans_lru ;
512+ ++stats.access .trans_lru ;
518513 }
519514 }
520515 }
521516 } else {
522517 assert (!extent->is_stable_writting ());
523518 assert (extent->is_pending_in_trans (t.get_trans_id ()));
524519 ++access_stats.trans_pending ;
525- ++stats.access .s . trans_pending ;
520+ ++stats.access .trans_pending ;
526521 if (extent->is_mutable ()) {
527522 assert (extent->is_fully_loaded ());
528523 assert (!extent->is_pending_io ());
@@ -564,11 +559,11 @@ class Cache : public ExtentTransViewRetriever {
564559 t, extent->get_type (), extent->get_paddr (), extent->get_length (),
565560 partial_off, partial_len, *extent);
566561 const auto t_src = t.get_src ();
567- extent_access_stats_t & access_stats = get_by_ext (
562+ cache_access_stats_t & access_stats = get_by_ext (
568563 get_by_src (stats.access_by_src_ext , t_src),
569564 extent->get_type ());
570565 ++access_stats.load_present ;
571- ++stats.access .s . load_present ;
566+ ++stats.access .load_present ;
572567 return trans_intr::make_interruptible (
573568 do_read_extent_maybe_partial (
574569 std::move (extent), partial_off, partial_len, &t_src));
@@ -878,11 +873,11 @@ class Cache : public ExtentTransViewRetriever {
878873 auto f = [&t, this , t_src](CachedExtent &ext) {
879874 // FIXME: assert(ext.is_stable_clean());
880875 assert (ext.is_stable ());
881- extent_access_stats_t & access_stats = get_by_ext (
876+ cache_access_stats_t & access_stats = get_by_ext (
882877 get_by_src (stats.access_by_src_ext , t_src),
883878 ext.get_type ());
884879 ++access_stats.load_absent ;
885- ++stats.access .s . load_absent ;
880+ ++stats.access .load_absent ;
886881
887882 t.add_to_read_set (CachedExtentRef (&ext));
888883 touch_extent (ext, &t_src, t.get_cache_hint ());
@@ -1763,7 +1758,7 @@ class Cache : public ExtentTransViewRetriever {
17631758
17641759 cache_access_stats_t access;
17651760 counter_by_src_t <uint64_t > cache_absent_by_src;
1766- counter_by_src_t <counter_by_extent_t <extent_access_stats_t > >
1761+ counter_by_src_t <counter_by_extent_t <cache_access_stats_t > >
17671762 access_by_src_ext;
17681763
17691764 uint64_t onode_tree_depth = 0 ;
@@ -1800,7 +1795,7 @@ class Cache : public ExtentTransViewRetriever {
18001795 mutable rewrite_stats_t last_reclaim_rewrites;
18011796 mutable cache_access_stats_t last_access;
18021797 mutable counter_by_src_t <uint64_t > last_cache_absent_by_src;
1803- mutable counter_by_src_t <counter_by_extent_t <extent_access_stats_t > >
1798+ mutable counter_by_src_t <counter_by_extent_t <cache_access_stats_t > >
18041799 last_access_by_src_ext;
18051800
18061801 void account_conflict (Transaction::src_t src1, Transaction::src_t src2) {
0 commit comments