Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to xxHash for Bloom filters; add convenience overload for trace_refs_recursive. #173

Merged
merged 5 commits into from
Nov 7, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Make PageAllocator less chatty; add compatibility overload of trace_r…
…efs_recursive.
tonyastolfi committed Nov 6, 2024
commit f205da52e3a563c84cf601153a7f6cc514dd09db
2 changes: 1 addition & 1 deletion src/llfs/page_allocator.hpp
Original file line number Diff line number Diff line change
@@ -395,7 +395,7 @@ inline StatusOr<slot_offset_type> PageAllocator::update_page_ref_counts(
sample_count.fetch_add(1);
prc_count.fetch_add(txn->ref_counts.size());

LLFS_LOG_INFO_EVERY_T(5.0 /*seconds*/)
LLFS_LOG_INFO_EVERY_T(100.0 /*seconds*/)
<< "Average pages per allocator update: "
<< ((double)prc_count.load() / (double)sample_count.load());

24 changes: 23 additions & 1 deletion src/llfs/trace_refs_recursive.hpp
Original file line number Diff line number Diff line change
@@ -24,7 +24,16 @@

namespace llfs {

template <typename IdTypePairSeq, typename Pred, typename Fn>
/** \brief Do a depth-first search of the page reference graph starting at roots.
*
* Starting at roots, calls page_tracer.trace_page_refs to find the outgoing references (edges).
* These are filtered by `should_recursively_trace` before being added to a stack of pages to
* recursively trace. Continues until the stack is empty.
*
* \return OkStatus if successful, otherwise the first error status code returned by
* page_tracer.trace_page_refs.
*/
template <typename IdTypePairSeq, typename Pred = bool(PageId), typename Fn = void(PageId)>
inline batt::Status trace_refs_recursive(PageTracer& page_tracer, IdTypePairSeq&& roots,
Pred&& should_recursively_trace, Fn&& fn)
{
@@ -59,6 +68,19 @@ inline batt::Status trace_refs_recursive(PageTracer& page_tracer, IdTypePairSeq&
return batt::OkStatus();
}

/** \brief Convenience overload; creates a LoadingPageTracer to wrap the page_loader arg, then calls
* the PageTracer variant of trace_refs_recursive.
*/
template <typename IdTypePairSeq, typename Pred, typename Fn>
inline batt::Status trace_refs_recursive(PageLoader& page_loader, IdTypePairSeq&& roots,
Pred&& should_recursively_trace, Fn&& fn)
{
LoadingPageTracer tracer_impl{page_loader};

return trace_refs_recursive(tracer_impl, BATT_FORWARD(roots),
BATT_FORWARD(should_recursively_trace), BATT_FORWARD(fn));
}

} // namespace llfs

#endif // LLFS_TRACE_REFS_RECURSIVE_HPP