efforts.retire.bytes += i->get_length();
}
- efforts.fresh.extents += t.get_num_fresh_blocks();
- t.for_each_fresh_block([&](auto &i) {
- efforts.fresh.bytes += i->get_length();
- });
+ auto& fresh_stats = t.get_fresh_block_stats();
+ efforts.fresh.extents += fresh_stats.num;
+ efforts.fresh.bytes += fresh_stats.bytes;
for (auto &i: t.mutated_block_list) {
if (!i->is_valid()) {
} else {
// read transaction won't have non-read efforts
assert(t.retired_set.empty());
- assert(t.get_num_fresh_blocks() == 0);
+ assert(t.get_fresh_block_stats().num == 0);
assert(t.mutated_block_list.empty());
assert(t.onode_tree_stats.is_clear());
assert(t.lba_tree_stats.is_clear());
}
// read transaction won't have non-read efforts
assert(t.retired_set.empty());
- assert(t.get_num_fresh_blocks() == 0);
+ assert(t.get_fresh_block_stats().num == 0);
assert(t.mutated_block_list.empty());
assert(t.onode_tree_stats.is_clear());
assert(t.lba_tree_stats.is_clear());
});
}
+ ceph_assert(t.get_fresh_block_stats().num ==
+ t.inline_block_list.size() +
+ t.ool_block_list.size() +
+ t.num_delayed_invalid_extents);
+
return record;
}
for (auto& extent : alloc_list) {
// extents may be invalidated
if (!extent->is_valid()) {
+ t.increment_delayed_invalid_extents();
continue;
}
if (should_be_inline(extent)) {
// ...but add_pin from parent->leaf
std::vector<CachedExtentRef> to_link;
- to_link.reserve(t.get_num_fresh_blocks());
+ to_link.reserve(t.get_fresh_block_stats().num);
t.for_each_fresh_block([&](auto &e) {
if (e->is_valid() && (is_lba_node(*e) || e->is_logical()))
to_link.push_back(e);
offset += ref->get_length();
inline_block_list.push_back(ref);
}
+ ++fresh_block_stats.num;
+ fresh_block_stats.bytes += ref->get_length();
TRACET("adding {} to write_set", *this, *ref);
write_set.insert(*ref);
}
std::for_each(inline_block_list.begin(), inline_block_list.end(), f);
}
- auto get_num_fresh_blocks() const {
- return inline_block_list.size() + ool_block_list.size();
+ struct io_stat_t {
+ uint64_t num = 0;
+ uint64_t bytes = 0;
+ };
+ const io_stat_t& get_fresh_block_stats() const {
+ return fresh_block_stats;
}
enum class src_t : uint8_t {
read_set.clear();
invalidate_clear_write_set();
mutated_block_list.clear();
+ fresh_block_stats = {};
+ num_delayed_invalid_extents = 0;
delayed_alloc_list.clear();
inline_block_list.clear();
ool_block_list.clear();
return lba_tree_stats;
}
+ void increment_delayed_invalid_extents() {
+ ++num_delayed_invalid_extents;
+ }
+
private:
friend class Cache;
friend Ref make_test_transaction();
/**
* lists of fresh blocks, holds refcounts, subset of write_set
*/
+ io_stat_t fresh_block_stats;
+ uint64_t num_delayed_invalid_extents = 0;
/// blocks that will be committed with journal record inline
std::list<CachedExtentRef> inline_block_list;
/// blocks that will be committed with out-of-line record