// after-free issue.
auto c = static_cast<AlienCollection*>(ch.get());
return store->getattr(c->collection, oid, name.c_str(), value);
- }).then([oid, &value] (int r) -> get_attr_errorator::future<ceph::bufferlist> {
+ }).then([oid, &value](int r) -> get_attr_errorator::future<ceph::bufferlist> {
if (r == -ENOENT) {
return crimson::ct_error::enoent::make();
} else if (r == -ENODATA) {
auto AlienStore::omap_get_header(CollectionRef ch,
const ghobject_t& oid)
- -> read_errorator::future<ceph::bufferlist>
+ -> get_attr_errorator::future<ceph::bufferlist>
{
assert(tp);
return do_with_op_gate(ceph::bufferlist(), [=](auto& bl) {
return tp->submit(ch->get_cid().hash_to_shard(tp->size()), [=, &bl] {
auto c = static_cast<AlienCollection*>(ch.get());
return store->omap_get_header(c->collection, oid, &bl);
- }).then([&bl] (int r) -> read_errorator::future<ceph::bufferlist> {
+ }).then([&bl](int r) -> get_attr_errorator::future<ceph::bufferlist> {
if (r == -ENOENT) {
return crimson::ct_error::enoent::make();
} else if (r < 0) {
logger().error("omap_get_header: {}", r);
- return crimson::ct_error::input_output_error::make();
+ ceph_assert(0 == "impossible");
} else {
- return read_errorator::make_ready_future<ceph::bufferlist>(
+ return get_attr_errorator::make_ready_future<ceph::bufferlist>(
std::move(bl));
}
});
seastar::future<struct stat> stat(
CollectionRef,
const ghobject_t&) final;
- read_errorator::future<ceph::bufferlist> omap_get_header(
+ get_attr_errorator::future<ceph::bufferlist> omap_get_header(
CollectionRef,
const ghobject_t&) final;
read_errorator::future<std::map<uint64_t, uint64_t>> fiemap(
auto
CyanStore::omap_get_header(CollectionRef ch,
const ghobject_t& oid)
- -> read_errorator::future<ceph::bufferlist>
+ -> get_attr_errorator::future<ceph::bufferlist>
{
auto c = static_cast<Collection*>(ch.get());
auto o = c->get_object(oid);
return crimson::ct_error::enoent::make();
}
- return read_errorator::make_ready_future<ceph::bufferlist>(
+ return get_attr_errorator::make_ready_future<ceph::bufferlist>(
o->omap_header);
}
const ghobject_t& end,
uint64_t limit) const final;
- read_errorator::future<ceph::bufferlist> omap_get_header(
+ get_attr_errorator::future<ceph::bufferlist> omap_get_header(
CollectionRef c,
const ghobject_t& oid) final;
const std::optional<std::string> &start ///< [in] start, empty for begin
) = 0; ///< @return <done, values> values.empty() only if done
- virtual read_errorator::future<bufferlist> omap_get_header(
+ virtual get_attr_errorator::future<bufferlist> omap_get_header(
CollectionRef c,
const ghobject_t& oid) = 0;
);
}
-auto
+SeaStore::get_attr_errorator::future<ceph::bufferlist>
SeaStore::omap_get_header(
- CollectionRef c,
+ CollectionRef ch,
const ghobject_t& oid)
- -> read_errorator::future<bufferlist>
{
- return seastar::make_ready_future<bufferlist>();
+ return get_attr(ch, oid, OMAP_HEADER_XATTR_KEY);
}
SeaStore::read_errorator::future<SeaStore::omap_values_t>
{
LOG_PREFIX(SeaStore::_omap_set_header);
DEBUGT("{} {} bytes", *ctx.transaction, *onode, header.length());
- assert(0 == "not supported yet");
- return tm_iertr::now();
+ std::map<std::string, bufferlist> to_set;
+ to_set[OMAP_HEADER_XATTR_KEY] = header;
+ return _setattrs(ctx, onode,std::move(to_set));
}
SeaStore::tm_ret SeaStore::_omap_clear(
{
LOG_PREFIX(SeaStore::_omap_clear);
DEBUGT("{} {} keys", *ctx.transaction, *onode);
- if (auto omap_root = onode->get_layout().omap_root.get(
- onode->get_metadata_hint(device->get_block_size()));
- omap_root.is_null()) {
- return seastar::now();
- } else {
- return seastar::do_with(
- BtreeOMapManager(*transaction_manager),
- onode->get_layout().omap_root.get(
- onode->get_metadata_hint(device->get_block_size())),
- [&ctx, &onode](
- auto &omap_manager,
- auto &omap_root) {
- return omap_manager.omap_clear(
- omap_root,
- *ctx.transaction)
- .si_then([&] {
- if (omap_root.must_update()) {
- onode->get_mutable_layout(*ctx.transaction
- ).omap_root.update(omap_root);
- }
+ return _xattr_rmattr(ctx, onode, std::string(OMAP_HEADER_XATTR_KEY))
+ .si_then([this, &ctx, &onode]() -> tm_ret {
+ if (auto omap_root = onode->get_layout().omap_root.get(
+ onode->get_metadata_hint(device->get_block_size()));
+ omap_root.is_null()) {
+ return seastar::now();
+ } else {
+ return seastar::do_with(
+ BtreeOMapManager(*transaction_manager),
+ onode->get_layout().omap_root.get(
+ onode->get_metadata_hint(device->get_block_size())),
+ [&ctx, &onode](
+ auto &omap_manager,
+ auto &omap_root) {
+ return omap_manager.omap_clear(
+ omap_root,
+ *ctx.transaction)
+ .si_then([&] {
+ if (omap_root.must_update()) {
+ onode->get_mutable_layout(*ctx.transaction
+ ).omap_root.update(omap_root);
+ }
+ });
});
- });
- }
+ }
+ });
}
SeaStore::tm_ret SeaStore::_omap_rmkeys(
const std::optional<std::string> &start ///< [in] start, empty for begin
) final; ///< @return <done, values> values.empty() iff done
- read_errorator::future<bufferlist> omap_get_header(
+ get_attr_errorator::future<bufferlist> omap_get_header(
CollectionRef c,
const ghobject_t& oid) final;
namespace crimson::os::seastore {
+/* using a special xattr key "omap_header" to store omap header */
+ const std::string OMAP_HEADER_XATTR_KEY = "omap_header";
+
/*
* Note: NULL value is usually the default and max value.
*/
const crimson::os::CollectionRef& c,
const ghobject_t& oid) const
{
- return store->omap_get_header(c, oid);
+ return store->omap_get_header(c, oid)
+ .handle_error(
+ crimson::ct_error::enodata::handle([] {
+ return seastar::make_ready_future<bufferlist>();
+ }),
+ ll_read_errorator::pass_further{}
+ );
}
PGBackend::ll_read_ierrorator::future<>