seastar::stop_iteration::yes);
}
auto &seq = iter->first;
- auto &backref_list = iter->second.br_list;
+ auto &backref_entry_refs = iter->second;
LOG_PREFIX(BtreeBackrefManager::merge_cached_backrefs);
DEBUGT("seq {}, limit {}, num_fresh_backref {}"
, t, seq, limit, t.get_num_fresh_backref());
if (seq <= limit && t.get_num_fresh_backref() * BACKREF_NODE_SIZE < max) {
inserted_to = seq;
return trans_intr::do_for_each(
- backref_list,
- [this, &t](auto &backref) {
+ backref_entry_refs,
+ [this, &t](auto &backref_entry_ref) {
LOG_PREFIX(BtreeBackrefManager::merge_cached_backrefs);
- if (backref.laddr != L_ADDR_NULL) {
+ auto &backref_entry = *backref_entry_ref;
+ if (backref_entry.laddr != L_ADDR_NULL) {
DEBUGT("new mapping: {}~{} -> {}",
- t, backref.paddr, backref.len, backref.laddr);
+ t,
+ backref_entry.paddr,
+ backref_entry.len,
+ backref_entry.laddr);
return new_mapping(
t,
- backref.paddr,
- backref.len,
- backref.laddr,
- backref.type).si_then([](auto &&pin) {
+ backref_entry.paddr,
+ backref_entry.len,
+ backref_entry.laddr,
+ backref_entry.type).si_then([](auto &&pin) {
return seastar::now();
});
} else {
- DEBUGT("remove mapping: {}", t, backref.paddr);
+ DEBUGT("remove mapping: {}", t, backref_entry.paddr);
return remove_mapping(
t,
- backref.paddr).si_then([](auto&&) {
+ backref_entry.paddr
+ ).si_then([](auto&&) {
return seastar::now();
}).handle_error_interruptible(
crimson::ct_error::input_output_error::pass_further(),
if (iter == backref_entryrefs_by_seq.end()) {
backref_entryrefs_by_seq.emplace(seq, std::move(list));
} else {
- for (auto &ref : list) {
- iter->second.br_list.push_back(*ref);
- }
- iter->second.backrefs.insert(
- iter->second.backrefs.end(),
+ iter->second.insert(
+ iter->second.end(),
std::make_move_iterator(list.begin()),
std::make_move_iterator(list.end()));
}
boost::intrusive::link_mode<
boost::intrusive::auto_unlink>>;
set_hook_t backref_set_hook;
-
- using list_hook_t =
- boost::intrusive::list_member_hook<
- boost::intrusive::link_mode<
- boost::intrusive::auto_unlink>>;
- list_hook_t backref_buf_hook;
-
using backref_set_member_options = boost::intrusive::member_hook<
backref_buf_entry_t,
set_hook_t,
backref_set_member_options,
boost::intrusive::constant_time_size<false>>;
- using backref_list_member_options = boost::intrusive::member_hook<
- backref_buf_entry_t,
- list_hook_t,
- &backref_buf_entry_t::backref_buf_hook>;
- using list_t = boost::intrusive::list<
- backref_buf_entry_t,
- backref_list_member_options,
- boost::intrusive::constant_time_size<false>>;
struct cmp_t {
using is_transparent = paddr_t;
bool operator()(
std::ostream &operator<<(std::ostream &out, const backref_buf_entry_t &ent);
-using backref_buf_entry_ref =
- std::unique_ptr<backref_buf_entry_t>;
-
+using backref_buf_entry_ref = std::unique_ptr<backref_buf_entry_t>;
using backref_set_t = backref_buf_entry_t::set_t;
-
-struct backref_buf_t {
- backref_buf_t(std::vector<backref_buf_entry_ref> &&refs) : backrefs(std::move(refs)) {
- for (auto &ref : backrefs) {
- br_list.push_back(*ref);
- }
- }
- std::vector<backref_buf_entry_ref> backrefs;
- backref_buf_entry_t::list_t br_list;
-};
-
-using backref_entryrefs_by_seq_t = std::map<journal_seq_t, backref_buf_t>;
+using backref_entry_refs_t = std::vector<backref_buf_entry_ref>;
+using backref_entryrefs_by_seq_t = std::map<journal_seq_t, backref_entry_refs_t>;
/**
* Cache