1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 #include "include/buffer.h"
5 #include "osd/osd_types.h"
6 #include "crimson/os/seastore/transaction_manager.h"
7 #include "crimson/os/seastore/collection_manager/collection_flat_node.h"
10 seastar::logger
& logger() {
11 return crimson::get_logger(ceph_subsys_seastore
);
15 namespace crimson::os::seastore::collection_manager
{
17 void delta_t::replay(coll_map_t
&l
) const
33 assert(0 == "impossible");
36 __builtin_unreachable();
41 std::ostream
&CollectionNode::print_detail_l(std::ostream
&out
) const
46 CollectionNode::list_ret
47 CollectionNode::list()
50 logger().debug("CollectionNode:{}, {}", __func__
, *this);
51 CollectionManager::list_ret_bare list_result
;
52 for (auto &[coll
, bits
] : decoded
) {
53 list_result
.emplace_back(coll
, bits
);
56 interruptible::ready_future_marker
{},
57 std::move(list_result
));
60 CollectionNode::create_ret
61 CollectionNode::create(coll_context_t cc
, coll_t coll
, unsigned bits
)
64 logger().debug("CollectionNode:{}", __func__
);
66 auto mut
= cc
.tm
.get_mutable_extent(cc
.t
, this)->cast
<CollectionNode
>();
67 return mut
->create(cc
, coll
, bits
);
69 logger().debug("CollectionNode::create {} {} {}", coll
, bits
, *this);
70 auto [iter
, inserted
] = decoded
.insert(coll
, bits
);
72 if (encoded_sizeof((base_coll_map_t
&)decoded
) > get_bptr().length()) {
75 interruptible::ready_future_marker
{},
76 create_result_t::OVERFLOW
);
78 if (auto buffer
= maybe_get_delta_buffer(); buffer
) {
79 buffer
->insert(coll
, bits
);
83 interruptible::ready_future_marker
{},
84 create_result_t::SUCCESS
);
88 CollectionNode::update_ret
89 CollectionNode::update(coll_context_t cc
, coll_t coll
, unsigned bits
)
92 logger().debug("CollectionNode:{}", __func__
);
94 auto mut
= cc
.tm
.get_mutable_extent(cc
.t
, this)->cast
<CollectionNode
>();
95 return mut
->update(cc
, coll
, bits
);
97 if (auto buffer
= maybe_get_delta_buffer(); buffer
) {
98 buffer
->update(coll
, bits
);
100 decoded
.update(coll
, bits
);
102 return seastar::now();
105 CollectionNode::remove_ret
106 CollectionNode::remove(coll_context_t cc
, coll_t coll
)
109 logger().debug("CollectionNode:{}", __func__
);
111 auto mut
= cc
.tm
.get_mutable_extent(cc
.t
, this)->cast
<CollectionNode
>();
112 return mut
->remove(cc
, coll
);
114 if (auto buffer
= maybe_get_delta_buffer(); buffer
) {
115 buffer
->remove(coll
);
117 decoded
.remove(coll
);
119 return seastar::now();