}
ECUtil::HashInfoRef ECBackend::get_hash_info(
- const hobject_t &hoid, bool checks)
+ const hobject_t &hoid, bool checks, const map<string,bufferptr> *attrs)
{
dout(10) << __func__ << ": Getting attr on " << hoid << dendl;
ECUtil::HashInfoRef ref = unstable_hashinfo_registry.lookup(hoid);
if (r >= 0) {
dout(10) << __func__ << ": found on disk, size " << st.st_size << dendl;
bufferlist bl;
- r = store->getattr(
- coll,
- ghobject_t(hoid, ghobject_t::NO_GEN, get_parent()->whoami_shard().shard),
- ECUtil::get_hinfo_key(),
- bl);
- if (r >= 0) {
+ if (attrs) {
+ map<string, bufferptr>::const_iterator k = attrs->find(ECUtil::get_hinfo_key());
+ if (k == attrs->end()) {
+ dout(5) << __func__ << " " << hoid << " missing hinfo attr" << dendl;
+ } else {
+ bl.push_back(k->second);
+ }
+ } else {
+ r = store->getattr(
+ coll,
+ ghobject_t(hoid, ghobject_t::NO_GEN, get_parent()->whoami_shard().shard),
+ ECUtil::get_hinfo_key(),
+ bl);
+ if (r < 0) {
+ dout(5) << __func__ << ": getattr failed: " << cpp_strerror(r) << dendl;
+ bl.clear(); // just in case
+ }
+ }
+ if (bl.length() > 0) {
bufferlist::iterator bp = bl.begin();
::decode(hinfo, bp);
if (checks && hinfo.get_total_chunk_size() != (uint64_t)st.st_size) {
return;
}
- ECUtil::HashInfoRef hinfo = get_hash_info(poid, false);
+ ECUtil::HashInfoRef hinfo = get_hash_info(poid, false, &o.attrs);
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, hobject_t::BitwiseComparator> unstable_hashinfo_registry;
- ECUtil::HashInfoRef get_hash_info(const hobject_t &hoid, bool checks = true);
+ ECUtil::HashInfoRef get_hash_info(const hobject_t &hoid, bool checks = true,
+ const map<string,bufferptr> *attr = NULL);
friend struct ReadCB;
void check_op(Op *op);