onode_layout_t() : omap_root(omap_type_t::OMAP), log_root(omap_type_t::LOG),
xattr_root(omap_type_t::XATTR) {}
+
+ const omap_root_le_t& get_root(omap_type_t type) const {
+ if (type == omap_type_t::XATTR) {
+ return xattr_root;
+ } else if (type == omap_type_t::OMAP) {
+ return omap_root;
+ } else {
+ ceph_assert(type == omap_type_t::LOG);
+ return log_root;
+ }
+ }
} __attribute__((packed));
class Transaction;
auto& layout = onode->get_layout();
return omap_list(
*onode,
- otype == omap_type_t::XATTR
- ? layout.xattr_root
- : layout.omap_root,
+ layout.get_root(otype),
*ctx.transaction,
start,
OMapManager::omap_list_config_t().with_inclusive(false, false)
- ).si_then([&ctx, &onode, &d_onode, this, otype, &start](auto p) mutable {
+ ).si_then([&ctx, &d_onode, this, otype, &start](auto p) mutable {
auto complete = std::get<0>(p);
auto &attrs = std::get<1>(p);
if (attrs.empty()) {
ctx,
d_onode,
std::map<std::string, ceph::bufferlist>(attrs.begin(), attrs.end()),
- otype == omap_type_t::XATTR
- ? d_onode->get_layout().xattr_root
- : d_onode->get_layout().omap_root
+ d_onode->get_layout().get_root(otype)
).si_then([complete, nstart=std::move(nstart),
&start]() mutable {
if (complete) {
return _clone_omaps(ctx, onode, d_onode, omap_type_t::XATTR);
}).si_then([&ctx, &onode, &d_onode, this] {
return _clone_omaps(ctx, onode, d_onode, omap_type_t::OMAP);
+ }).si_then([&ctx, &onode, &d_onode, this] {
+ return _clone_omaps(ctx, onode, d_onode, omap_type_t::LOG);
});
}