CollectionNode::list_ret
CollectionNode::list()
{
- read_to_local();
logger().debug("CollectionNode:{}, {}", __func__, *this);
CollectionManager::list_ret_bare list_result;
for (auto &[coll, bits] : decoded) {
CollectionNode::create_ret
CollectionNode::create(coll_context_t cc, coll_t coll, unsigned bits)
{
- read_to_local();
logger().debug("CollectionNode:{}", __func__);
if (!is_mutable()) {
auto mut = cc.tm.get_mutable_extent(cc.t, this)->cast<CollectionNode>();
CollectionNode::update_ret
CollectionNode::update(coll_context_t cc, coll_t coll, unsigned bits)
{
- read_to_local();
- logger().debug("CollectionNode:{}", __func__);
+ logger().debug("trans.{} CollectionNode:{} {} {}",
+ cc.t.get_trans_id(), __func__, coll, bits);
if (!is_mutable()) {
auto mut = cc.tm.get_mutable_extent(cc.t, this)->cast<CollectionNode>();
return mut->update(cc, coll, bits);
CollectionNode::remove_ret
CollectionNode::remove(coll_context_t cc, coll_t coll)
{
- read_to_local();
- logger().debug("CollectionNode:{}", __func__);
+ logger().debug("trans.{} CollectionNode:{} {}",
+ cc.t.get_trans_id(),__func__, coll);
if (!is_mutable()) {
auto mut = cc.tm.get_mutable_extent(cc.t, this)->cast<CollectionNode>();
return mut->remove(cc, coll);
: LogicalCachedExtent {
using CollectionNodeRef = TCachedExtentRef<CollectionNode>;
- bool loaded = false;
-
- template <typename... T>
- CollectionNode(T&&... t)
- : LogicalCachedExtent(std::forward<T>(t)...) {}
+ explicit CollectionNode(ceph::bufferptr &&ptr)
+ : LogicalCachedExtent(std::move(ptr)) {}
+ explicit CollectionNode(const CollectionNode &other)
+ : LogicalCachedExtent(other),
+ decoded(other.decoded) {}
static constexpr extent_types_t type = extent_types_t::COLL_BLOCK;
using update_ret = CollectionManager::update_ret;
update_ret update(coll_context_t cc, coll_t coll, unsigned bits);
- void read_to_local() {
- if (loaded) return;
+ void on_clean_read() final {
bufferlist bl;
bl.append(get_bptr());
auto iter = bl.cbegin();
decode((base_coll_map_t&)decoded, iter);
- loaded = true;
}
void copy_to_node() {
coll_root.update(root_extent->get_laddr(), root_extent->get_length());
root_extent->decoded = extent->decoded;
- root_extent->loaded = true;
return root_extent->create(
get_coll_context(t), cid, info.split_bits
).si_then([=, this, &t](auto result) {