]>
git.proxmox.com Git - ceph.git/blob - ceph/src/crimson/os/seastore/cached_extent.cc
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 #include "crimson/os/seastore/cached_extent.h"
6 #include "crimson/common/log.h"
9 [[maybe_unused
]] seastar::logger
& logger() {
10 return crimson::get_logger(ceph_subsys_seastore_tm
);
14 namespace crimson::os::seastore
{
16 #ifdef DEBUG_CACHED_EXTENT_REF
18 void intrusive_ptr_add_ref(CachedExtent
*ptr
)
20 intrusive_ptr_add_ref(
21 static_cast<boost::intrusive_ref_counter
<
23 boost::thread_unsafe_counter
>*>(ptr
));
24 logger().debug("intrusive_ptr_add_ref: {}", *ptr
);
27 void intrusive_ptr_release(CachedExtent
*ptr
)
29 logger().debug("intrusive_ptr_release: {}", *ptr
);
30 intrusive_ptr_release(
31 static_cast<boost::intrusive_ref_counter
<
33 boost::thread_unsafe_counter
>*>(ptr
));
38 std::ostream
&operator<<(std::ostream
&out
, CachedExtent::extent_state_t state
)
41 case CachedExtent::extent_state_t::INITIAL_WRITE_PENDING
:
42 return out
<< "INITIAL_WRITE_PENDING";
43 case CachedExtent::extent_state_t::MUTATION_PENDING
:
44 return out
<< "MUTATION_PENDING";
45 case CachedExtent::extent_state_t::CLEAN_PENDING
:
46 return out
<< "CLEAN_PENDING";
47 case CachedExtent::extent_state_t::CLEAN
:
48 return out
<< "CLEAN";
49 case CachedExtent::extent_state_t::DIRTY
:
50 return out
<< "DIRTY";
51 case CachedExtent::extent_state_t::INVALID
:
52 return out
<< "INVALID";
54 return out
<< "UNKNOWN";
58 std::ostream
&operator<<(std::ostream
&out
, const CachedExtent
&ext
)
60 return ext
.print(out
);
63 CachedExtent::~CachedExtent()
67 parent_index
->erase(*this);
71 std::ostream
&LogicalCachedExtent::print_detail(std::ostream
&out
) const
73 out
<< ", laddr=" << laddr
;
75 out
<< ", pin=" << *pin
;
79 return print_detail_l(out
);
82 std::ostream
&operator<<(std::ostream
&out
, const LBAPin
&rhs
)
84 return out
<< "LBAPin(" << rhs
.get_laddr() << "~" << rhs
.get_length()
85 << "->" << rhs
.get_paddr();
88 std::ostream
&operator<<(std::ostream
&out
, const lba_pin_list_t
&rhs
)
92 for (const auto &i
: rhs
) {
93 out
<< (first
? "" : ",") << *i
;