summaryrefslogtreecommitdiffstats
path: root/src/crimson/os/seastore/lba_mapping.cc
blob: 90fae09ce2150c4c20888ea0a0e49c576774b6e8 (plain)
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
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab

#include "lba_mapping.h"

namespace crimson::os::seastore {

std::ostream &operator<<(std::ostream &out, const LBAMapping &rhs)
{
  out << "LBAMapping(" << rhs.get_key()
      << "~0x" << std::hex << rhs.get_length() << std::dec
      << "->" << rhs.get_val();
  if (rhs.is_indirect()) {
    out << ",indirect(" << rhs.get_intermediate_base()
        << "~0x" << std::hex << rhs.get_intermediate_length()
        << "@0x" << rhs.get_intermediate_offset() << std::dec
        << ")";
  }
  out << ")";
  return out;
}

std::ostream &operator<<(std::ostream &out, const lba_pin_list_t &rhs)
{
  bool first = true;
  out << '[';
  for (const auto &i: rhs) {
    out << (first ? "" : ",") << *i;
    first = false;
  }
  return out << ']';
}

LBAMappingRef LBAMapping::duplicate() const {
  auto ret = _duplicate(ctx);
  ret->range = range;
  ret->value = value;
  ret->parent = parent;
  ret->len = len;
  ret->pos = pos;
  return ret;
}

} // namespace crimson::os::seastore