: tm(tm) {}
BtreeOMapManager::initialize_omap_ret
-BtreeOMapManager::initialize_omap(Transaction &t)
+BtreeOMapManager::initialize_omap(Transaction &t, laddr_t hint)
{
logger().debug("{}", __func__);
- return tm.alloc_extent<OMapLeafNode>(t, L_ADDR_MIN, OMAP_BLOCK_SIZE)
- .si_then([](auto&& root_extent) {
+ return tm.alloc_extent<OMapLeafNode>(t, hint, OMAP_BLOCK_SIZE)
+ .si_then([hint](auto&& root_extent) {
root_extent->set_size(0);
omap_node_meta_t meta{1};
root_extent->set_meta(meta);
omap_root_t omap_root;
- omap_root.update(root_extent->get_laddr(), 1);
+ omap_root.update(root_extent->get_laddr(), 1, hint);
return initialize_omap_iertr::make_ready_future<omap_root_t>(omap_root);
});
}
omap_root_t &omap_root,
const OMapNode::mutation_result_t& mresult)
{
- return oc.tm.alloc_extent<OMapInnerNode>(oc.t, L_ADDR_MIN, OMAP_BLOCK_SIZE)
+ return oc.tm.alloc_extent<OMapInnerNode>(oc.t, omap_root.hint, OMAP_BLOCK_SIZE)
.si_then([&omap_root, mresult](auto&& nroot) -> handle_root_split_ret {
auto [left, right, pivot] = *(mresult.split_tuple);
omap_node_meta_t meta{omap_root.depth + 1};
"", nroot->maybe_get_delta_buffer());
nroot->journal_inner_insert(nroot->iter_begin() + 1, right->get_laddr(),
pivot, nroot->maybe_get_delta_buffer());
- omap_root.update(nroot->get_laddr(), omap_root.get_depth() + 1);
+ omap_root.update(nroot->get_laddr(), omap_root.get_depth() + 1, omap_root.hint);
return seastar::now();
});
}
auto iter = root->cast<OMapInnerNode>()->iter_begin();
omap_root.update(
iter->get_val(),
- omap_root.depth -= 1);
+ omap_root.depth -= 1,
+ omap_root.hint);
return oc.tm.dec_ref(oc.t, root->get_laddr()
).si_then([](auto &&ret) -> handle_root_merge_ret {
return seastar::now();
{
logger().debug("{}: {}", __func__, key);
return get_omap_root(
- get_omap_context(t),
+ get_omap_context(t, omap_root.hint),
omap_root
- ).si_then([this, &t, &key](auto&& extent) {
- return extent->get_value(get_omap_context(t), key);
+ ).si_then([this, &t, &key, &omap_root](auto&& extent) {
+ return extent->get_value(get_omap_context(t, omap_root.hint), key);
}).si_then([](auto &&e) {
return omap_get_value_ret(
interruptible::ready_future_marker{},
{
logger().debug("{}: {} -> {}", __func__, key, value);
return get_omap_root(
- get_omap_context(t),
+ get_omap_context(t, omap_root.hint),
omap_root
- ).si_then([this, &t, &key, &value](auto root) {
- return root->insert(get_omap_context(t), key, value);
+ ).si_then([this, &t, &key, &value, &omap_root](auto root) {
+ return root->insert(get_omap_context(t, omap_root.hint), key, value);
}).si_then([this, &omap_root, &t](auto mresult) -> omap_set_key_ret {
if (mresult.status == mutation_status_t::SUCCESS)
return seastar::now();
else if (mresult.status == mutation_status_t::WAS_SPLIT)
- return handle_root_split(get_omap_context(t), omap_root, mresult);
+ return handle_root_split(get_omap_context(t, omap_root.hint), omap_root, mresult);
else
return seastar::now();
});
{
logger().debug("{}: {}", __func__, key);
return get_omap_root(
- get_omap_context(t),
+ get_omap_context(t, omap_root.hint),
omap_root
- ).si_then([this, &t, &key](auto root) {
- return root->rm_key(get_omap_context(t), key);
+ ).si_then([this, &t, &key, &omap_root](auto root) {
+ return root->rm_key(get_omap_context(t, omap_root.hint), key);
}).si_then([this, &omap_root, &t](auto mresult) -> omap_rm_key_ret {
if (mresult.status == mutation_status_t::SUCCESS) {
return seastar::now();
} else if (mresult.status == mutation_status_t::WAS_SPLIT) {
- return handle_root_split(get_omap_context(t), omap_root, mresult);
+ return handle_root_split(get_omap_context(t, omap_root.hint), omap_root, mresult);
} else if (mresult.status == mutation_status_t::NEED_MERGE) {
auto root = *(mresult.need_merge);
if (root->get_node_size() == 1 && omap_root.depth != 1) {
- return handle_root_merge(get_omap_context(t), omap_root, mresult);
+ return handle_root_merge(get_omap_context(t, omap_root.hint), omap_root, mresult);
} else {
return seastar::now();
}
{
logger().debug("{}", __func__);
return get_omap_root(
- get_omap_context(t),
+ get_omap_context(t, omap_root.hint),
omap_root
- ).si_then([this, config, &t, &start](auto extent) {
+ ).si_then([this, config, &t, &start, &omap_root](auto extent) {
return extent->list(
- get_omap_context(t),
+ get_omap_context(t, omap_root.hint),
start,
config);
});
{
logger().debug("{}", __func__);
return get_omap_root(
- get_omap_context(t),
+ get_omap_context(t, omap_root.hint),
omap_root
- ).si_then([this, &t](auto extent) {
- return extent->clear(get_omap_context(t));
+ ).si_then([this, &t, &omap_root](auto extent) {
+ return extent->clear(get_omap_context(t, omap_root.hint));
}).si_then([this, &omap_root, &t] {
return tm.dec_ref(
t, omap_root.get_location()
).si_then([&omap_root] (auto ret) {
omap_root.update(
L_ADDR_NULL,
- 0);
+ 0, L_ADDR_MIN);
return omap_clear_iertr::now();
});
}).handle_error_interruptible(
}
return _omap_get_value(
t,
- layout.xattr_root.get(),
+ layout.xattr_root.get(onode.get_hint()),
name);
}
).handle_error(crimson::ct_error::input_output_error::handle([FNAME] {
op_type_t::GET_ATTRS,
[=](auto &t, auto& onode) {
auto& layout = onode.get_layout();
- return _omap_list(layout.xattr_root, t, std::nullopt,
+ return _omap_list(onode, layout.xattr_root, t, std::nullopt,
OMapManager::omap_list_config_t::with_inclusive(false)
).si_then([&layout](auto p) {
auto& attrs = std::get<1>(p);
Transaction::src_t::READ,
op_type_t::OMAP_GET_VALUES,
[this, keys](auto &t, auto &onode) {
- omap_root_t omap_root = onode.get_layout().omap_root.get();
+ omap_root_t omap_root = onode.get_layout().omap_root.get(onode.get_hint());
return _omap_get_values(
t,
std::move(omap_root),
}
SeaStore::_omap_list_ret SeaStore::_omap_list(
+ Onode &onode,
const omap_root_le_t& omap_root,
Transaction& t,
const std::optional<std::string>& start,
OMapManager::omap_list_config_t config) const
{
- auto root = omap_root.get();
+ auto root = omap_root.get(onode.get_hint());
if (root.is_null()) {
return seastar::make_ready_future<_omap_list_bare_ret>(
true, omap_values_t{}
op_type_t::OMAP_LIST,
[this, config, &start](auto &t, auto &onode) {
return _omap_list(
+ onode,
onode.get_layout().omap_root,
t, start, config
);
SeaStore::omap_set_kvs_ret
SeaStore::_omap_set_kvs(
+ OnodeRef &onode,
const omap_root_le_t& omap_root,
Transaction& t,
omap_root_le_t& mutable_omap_root,
{
return seastar::do_with(
BtreeOMapManager(*transaction_manager),
- omap_root.get(),
+ omap_root.get(onode->get_hint()),
[&, keys=std::move(kvs)](auto &omap_manager, auto &root) {
tm_iertr::future<> maybe_create_root =
!root.is_null() ?
tm_iertr::now() :
omap_manager.initialize_omap(
- t
+ t, onode->get_hint()
).si_then([&root](auto new_root) {
root = new_root;
});
LOG_PREFIX(SeaStore::_omap_set_values);
DEBUGT("{} {} keys", *ctx.transaction, *onode, aset.size());
return _omap_set_kvs(
+ onode,
onode->get_layout().omap_root,
*ctx.transaction,
onode->get_mutable_layout(*ctx.transaction).omap_root,
{
LOG_PREFIX(SeaStore::_omap_rmkeys);
DEBUGT("{} {} keys", *ctx.transaction, *onode, keys.size());
- auto omap_root = onode->get_layout().omap_root.get();
+ auto omap_root = onode->get_layout().omap_root.get(onode->get_hint());
if (omap_root.is_null()) {
return seastar::now();
} else {
return seastar::do_with(
BtreeOMapManager(*transaction_manager),
- onode->get_layout().omap_root.get(),
+ onode->get_layout().omap_root.get(onode->get_hint()),
std::move(keys),
[&ctx, &onode](
auto &omap_manager,
}
return _omap_set_kvs(
+ onode,
onode->get_layout().xattr_root,
*ctx.transaction,
layout.xattr_root,