// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab #include "crimson/os/seastore/cached_extent.h" #include "crimson/common/log.h" namespace { [[maybe_unused]] seastar::logger& logger() { return crimson::get_logger(ceph_subsys_filestore); } } namespace crimson::os::seastore { #ifdef DEBUG_CACHED_EXTENT_REF void intrusive_ptr_add_ref(CachedExtent *ptr) { intrusive_ptr_add_ref( static_cast*>(ptr)); logger().debug("intrusive_ptr_add_ref: {}", *ptr); } void intrusive_ptr_release(CachedExtent *ptr) { logger().debug("intrusive_ptr_release: {}", *ptr); intrusive_ptr_release( static_cast*>(ptr)); } #endif std::ostream &operator<<(std::ostream &out, CachedExtent::extent_state_t state) { switch (state) { case CachedExtent::extent_state_t::INITIAL_WRITE_PENDING: return out << "INITIAL_WRITE_PENDING"; case CachedExtent::extent_state_t::MUTATION_PENDING: return out << "MUTATION_PENDING"; case CachedExtent::extent_state_t::CLEAN: return out << "CLEAN"; case CachedExtent::extent_state_t::DIRTY: return out << "DIRTY"; case CachedExtent::extent_state_t::INVALID: return out << "INVALID"; default: return out << "UNKNOWN"; } } std::ostream &operator<<(std::ostream &out, const CachedExtent &ext) { return ext.print(out); } CachedExtent::~CachedExtent() { if (parent_index) { parent_index->erase(*this); } } std::ostream &LogicalCachedExtent::print_detail(std::ostream &out) const { out << ", laddr=" << laddr; if (pin) { out << ", pin=" << *pin; } else { out << ", pin=empty"; } return print_detail_l(out); } std::ostream &operator<<(std::ostream &out, const LBAPin &rhs) { return out << "LBAPin(" << rhs.get_laddr() << "~" << rhs.get_length() << "->" << rhs.get_paddr(); } std::ostream &operator<<(std::ostream &out, const lba_pin_list_t &rhs) { bool first = true; out << '['; for (auto &i: rhs) { out << (first ? "" : ",") << *i; first = false; } return out << ']'; } }