1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
// -*- 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<boost::intrusive_ref_counter<
CachedExtent,
boost::thread_unsafe_counter>*>(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<boost::intrusive_ref_counter<
CachedExtent,
boost::thread_unsafe_counter>*>(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 << ']';
}
}
|