]> git.proxmox.com Git - ceph.git/blame - ceph/src/crimson/os/seastore/onode_manager/staged-fltree/node_impl.cc
buildsys: switch source download to quincy
[ceph.git] / ceph / src / crimson / os / seastore / onode_manager / staged-fltree / node_impl.cc
CommitLineData
f67539c2
TL
1// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:nil -*-
2// vim: ts=8 sw=2 smarttab
3
4#include "node_impl.h"
5#include "node_layout.h"
6
7namespace crimson::os::seastore::onode {
8
9#ifdef UNIT_TESTS_BUILT
10last_split_info_t last_split = {};
11#endif
12
13// XXX: branchless allocation
14InternalNodeImpl::alloc_ertr::future<InternalNodeImpl::fresh_impl_t>
15InternalNodeImpl::allocate(
16 context_t c, field_type_t type, bool is_level_tail, level_t level) {
17 if (type == field_type_t::N0) {
18 return InternalNode0::allocate(c, is_level_tail, level);
19 } else if (type == field_type_t::N1) {
20 return InternalNode1::allocate(c, is_level_tail, level);
21 } else if (type == field_type_t::N2) {
22 return InternalNode2::allocate(c, is_level_tail, level);
23 } else if (type == field_type_t::N3) {
24 return InternalNode3::allocate(c, is_level_tail, level);
25 } else {
26 ceph_abort("impossible path");
27 }
28}
29
30LeafNodeImpl::alloc_ertr::future<LeafNodeImpl::fresh_impl_t>
31LeafNodeImpl::allocate(
32 context_t c, field_type_t type, bool is_level_tail) {
33 if (type == field_type_t::N0) {
34 return LeafNode0::allocate(c, is_level_tail, 0);
35 } else if (type == field_type_t::N1) {
36 return LeafNode1::allocate(c, is_level_tail, 0);
37 } else if (type == field_type_t::N2) {
38 return LeafNode2::allocate(c, is_level_tail, 0);
39 } else if (type == field_type_t::N3) {
40 return LeafNode3::allocate(c, is_level_tail, 0);
41 } else {
42 ceph_abort("impossible path");
43 }
44}
45
46InternalNodeImplURef InternalNodeImpl::load(
47 NodeExtentRef extent, field_type_t type, bool expect_is_level_tail) {
48 if (type == field_type_t::N0) {
49 return InternalNode0::load(extent, expect_is_level_tail);
50 } else if (type == field_type_t::N1) {
51 return InternalNode1::load(extent, expect_is_level_tail);
52 } else if (type == field_type_t::N2) {
53 return InternalNode2::load(extent, expect_is_level_tail);
54 } else if (type == field_type_t::N3) {
55 return InternalNode3::load(extent, expect_is_level_tail);
56 } else {
57 ceph_abort("impossible path");
58 }
59}
60
61LeafNodeImplURef LeafNodeImpl::load(
62 NodeExtentRef extent, field_type_t type, bool expect_is_level_tail) {
63 if (type == field_type_t::N0) {
64 return LeafNode0::load(extent, expect_is_level_tail);
65 } else if (type == field_type_t::N1) {
66 return LeafNode1::load(extent, expect_is_level_tail);
67 } else if (type == field_type_t::N2) {
68 return LeafNode2::load(extent, expect_is_level_tail);
69 } else if (type == field_type_t::N3) {
70 return LeafNode3::load(extent, expect_is_level_tail);
71 } else {
72 ceph_abort("impossible path");
73 }
74}
75
76}