: PGBackend(cct, pg, store, coll, ch),
read_pipeline(cct, ec_impl, this->sinfo, get_parent()->get_eclistener()),
rmw_pipeline(cct, ec_impl, this->sinfo, get_parent()->get_eclistener(), *this),
+ unstable_hashinfo_registry(cct, ec_impl),
ec_impl(ec_impl),
sinfo(ec_impl->get_data_chunk_count(), stripe_width) {
ceph_assert((ec_impl->get_data_chunk_count() *
auto bp = op.xattrs[ECUtil::get_hinfo_key()].cbegin();
decode(hinfo, bp);
}
- op.hinfo = unstable_hashinfo_registry.lookup_or_create(hoid, hinfo);
+ op.hinfo = unstable_hashinfo_registry.maybe_put_hash_info(hoid, std::move(hinfo));
}
ceph_assert(op.xattrs.size());
ceph_assert(op.obc);
std::make_unique<RecoveryReadCompleter>(*this));
}
+void ECBackend::RecoveryBackend::continue_recovery_op(
+ RecoveryBackend::RecoveryOp &op,
+ RecoveryMessages *m)
+{
+}
+
void ECBackend::continue_recovery_op(
RecoveryOp &op,
RecoveryMessages *m)
if (op.recovery_progress.first && op.obc) {
/* We've got the attrs and the hinfo, might as well use them */
- op.hinfo = get_hash_info(op.hoid, false, op.obc->attr_cache, op.obc->obs.oi.size);
+ op.hinfo = unstable_hashinfo_registry.get_hash_info(op.hoid, false, op.obc->attr_cache, op.obc->obs.oi.size);
if (!op.hinfo) {
derr << __func__ << ": " << op.hoid << " has inconsistent hinfo"
<< dendl;
r = PGBackend::objects_get_attrs(i->first, &attrs);
}
if (r >= 0) {
- hinfo = get_hash_info(i->first, false, attrs, st.st_size);
+ hinfo = unstable_hashinfo_registry.get_hash_info(i->first, false, attrs, st.st_size);
} else {
derr << __func__ << ": access (attrs) on " << i->first << " failed: "
<< cpp_strerror(r) << dendl;
sinfo,
*(op->t),
[&](const hobject_t &i) {
- ECUtil::HashInfoRef ref = get_hash_info(
+ ECUtil::HashInfoRef ref = unstable_hashinfo_registry.get_hash_info(
i,
true,
op->t->obc_map[hoid]->attr_cache,
rmw_pipeline.start_rmw(std::move(op));
}
+ECUtil::HashInfoRef ECBackend::UnstableHashInfoRegistry::maybe_put_hash_info(
+ const hobject_t &hoid,
+ ECUtil::HashInfo &&hinfo)
+{
+ return registry.lookup_or_create(hoid, hinfo);
+}
-ECUtil::HashInfoRef ECBackend::get_hash_info(
+ECUtil::HashInfoRef ECBackend::UnstableHashInfoRegistry::get_hash_info(
const hobject_t &hoid,
bool create,
const map<string, bufferlist, less<>>& attrs,
uint64_t size)
{
dout(10) << __func__ << ": Getting attr on " << hoid << dendl;
- ECUtil::HashInfoRef ref = unstable_hashinfo_registry.lookup(hoid);
+ ECUtil::HashInfoRef ref = registry.lookup(hoid);
if (!ref) {
dout(10) << __func__ << ": not in cache " << hoid << dendl;
ECUtil::HashInfo hinfo(ec_impl->get_chunk_count());
create = true;
}
if (create) {
- ref = unstable_hashinfo_registry.lookup_or_create(hoid, hinfo);
+ ref = registry.lookup_or_create(hoid, hinfo);
}
}
return ref;
return -EINPROGRESS;
}
- ECUtil::HashInfoRef hinfo = get_hash_info(poid, false, o.attrs, o.size);
+ ECUtil::HashInfoRef hinfo = unstable_hashinfo_registry.get_hash_info(poid, false, o.attrs, o.size);
if (!hinfo) {
dout(0) << "_scan_list " << poid << " could not retrieve hash info" << dendl;
o.read_error = true;
const ECUtil::stripe_info_t sinfo;
- /// If modified, ensure that the ref is held until the update is applied
- SharedPtrRegistry<hobject_t, ECUtil::HashInfo> unstable_hashinfo_registry;
- ECUtil::HashInfoRef get_hash_info(const hobject_t &hoid,
- bool create,
- const std::map<std::string, ceph::buffer::list, std::less<>>& attr,
- uint64_t size);
+
+ class UnstableHashInfoRegistry {
+ CephContext *cct;
+ ceph::ErasureCodeInterfaceRef ec_impl;
+ /// If modified, ensure that the ref is held until the update is applied
+ SharedPtrRegistry<hobject_t, ECUtil::HashInfo> registry;
+
+ public:
+ UnstableHashInfoRegistry(
+ CephContext *cct,
+ ceph::ErasureCodeInterfaceRef ec_impl)
+ : cct(cct),
+ ec_impl(std::move(ec_impl)) {}
+
+ ECUtil::HashInfoRef maybe_put_hash_info(
+ const hobject_t &hoid,
+ ECUtil::HashInfo &&hinfo);
+
+ ECUtil::HashInfoRef get_hash_info(
+ const hobject_t &hoid,
+ bool create,
+ const std::map<std::string, ceph::buffer::list, std::less<>>& attr,
+ uint64_t size);
+ } unstable_hashinfo_registry;
int object_stat(const hobject_t &hoid, struct stat* st);