]> git.proxmox.com Git - ceph.git/blame - ceph/src/crimson/os/seastore/seastore_types.cc
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / crimson / os / seastore / seastore_types.cc
CommitLineData
f67539c2
TL
1// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2// vim: ts=8 sw=2 smarttab
3
4#include "crimson/os/seastore/seastore_types.h"
5
6namespace crimson::os::seastore {
7
8std::ostream &segment_to_stream(std::ostream &out, const segment_id_t &t)
9{
10 if (t == NULL_SEG_ID)
11 return out << "NULL_SEG";
12 else if (t == BLOCK_REL_SEG_ID)
13 return out << "BLOCK_REL_SEG";
14 else if (t == RECORD_REL_SEG_ID)
15 return out << "RECORD_REL_SEG";
16 else if (t == FAKE_SEG_ID)
17 return out << "FAKE_SEG";
18 else
19 return out << t;
20}
21
22std::ostream &offset_to_stream(std::ostream &out, const segment_off_t &t)
23{
24 if (t == NULL_SEG_OFF)
25 return out << "NULL_OFF";
26 else
27 return out << t;
28}
29
30std::ostream &operator<<(std::ostream &out, const paddr_t &rhs)
31{
32 out << "paddr_t<";
33 segment_to_stream(out, rhs.segment);
34 out << ", ";
35 offset_to_stream(out, rhs.offset);
36 return out << ">";
37}
38
39std::ostream &operator<<(std::ostream &out, const journal_seq_t &seq)
40{
41 return out << "journal_seq_t(segment_seq="
42 << seq.segment_seq << ", offset="
43 << seq.offset
44 << ")";
45}
46
47std::ostream &operator<<(std::ostream &out, extent_types_t t)
48{
49 switch (t) {
50 case extent_types_t::ROOT:
51 return out << "ROOT";
52 case extent_types_t::LADDR_INTERNAL:
53 return out << "LADDR_INTERNAL";
54 case extent_types_t::LADDR_LEAF:
55 return out << "LADDR_LEAF";
56 case extent_types_t::EXTMAP_INNER:
57 return out << "EXTMAP_INNER";
58 case extent_types_t::EXTMAP_LEAF:
59 return out << "EXTMAP_LEAF";
60 case extent_types_t::ONODE_BLOCK_STAGED:
61 return out << "ONODE_BLOCK_STAGED";
62 case extent_types_t::TEST_BLOCK:
63 return out << "TEST_BLOCK";
64 case extent_types_t::TEST_BLOCK_PHYSICAL:
65 return out << "TEST_BLOCK_PHYSICAL";
66 case extent_types_t::NONE:
67 return out << "NONE";
68 default:
69 return out << "UNKNOWN";
70 }
71}
72
73std::ostream &operator<<(std::ostream &out, const laddr_list_t &rhs)
74{
75 bool first = false;
76 for (auto &i: rhs) {
77 out << (first ? '[' : ',') << '(' << i.first << ',' << i.second << ')';
78 first = true;
79 }
80 return out << ']';
81}
82std::ostream &operator<<(std::ostream &out, const paddr_list_t &rhs)
83{
84 bool first = false;
85 for (auto &i: rhs) {
86 out << (first ? '[' : ',') << '(' << i.first << ',' << i.second << ')';
87 first = true;
88 }
89 return out << ']';
90}
91
92std::ostream &operator<<(std::ostream &lhs, const delta_info_t &rhs)
93{
94 return lhs << "delta_info_t("
95 << "type: " << rhs.type
96 << ", paddr: " << rhs.paddr
97 << ", laddr: " << rhs.laddr
98 << ", prev_crc: " << rhs.prev_crc
99 << ", final_crc: " << rhs.final_crc
100 << ", length: " << rhs.length
101 << ", pversion: " << rhs.pversion
102 << ")";
103}
104
105}