}
ECUtil::HashInfoRef ECBackend::get_hash_info(
- const hobject_t &hoid, bool checks, const map<string,bufferptr> *attrs)
+ const hobject_t &hoid, bool create, const map<string,bufferptr> *attrs)
{
dout(10) << __func__ << ": Getting attr on " << hoid << dendl;
ECUtil::HashInfoRef ref = unstable_hashinfo_registry.lookup(hoid);
ghobject_t(hoid, ghobject_t::NO_GEN, get_parent()->whoami_shard().shard),
&st);
ECUtil::HashInfo hinfo(ec_impl->get_chunk_count());
- // XXX: What does it mean if there is no object on disk?
if (r >= 0) {
dout(10) << __func__ << ": found on disk, size " << st.st_size << dendl;
bufferlist bl;
dout(0) << __func__ << ": Can't decode hinfo for " << hoid << dendl;
return ECUtil::HashInfoRef();
}
- if (checks && hinfo.get_total_chunk_size() != (uint64_t)st.st_size) {
+ if (hinfo.get_total_chunk_size() != (uint64_t)st.st_size) {
dout(0) << __func__ << ": Mismatch of total_chunk_size "
<< hinfo.get_total_chunk_size() << dendl;
return ECUtil::HashInfoRef();
} else if (st.st_size > 0) { // If empty object and no hinfo, create it
return ECUtil::HashInfoRef();
}
+ } else if (r != -ENOENT || !create) {
+ derr << __func__ << ": stat " << hoid << " failed: " << cpp_strerror(r)
+ << dendl;
+ return ECUtil::HashInfoRef();
}
ref = unstable_hashinfo_registry.lookup_or_create(hoid, hinfo);
}
sinfo,
std::move(t),
[&](const hobject_t &i) {
- ECUtil::HashInfoRef ref = get_hash_info(i, false);
+ ECUtil::HashInfoRef ref = get_hash_info(i, true);
if (!ref) {
derr << __func__ << ": get_hash_info(" << i << ")"
<< " returned a null pointer and there is no "
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 checks = true,
+ ECUtil::HashInfoRef get_hash_info(const hobject_t &hoid, bool create = false,
const std::map<std::string, ceph::buffer::ptr> *attr = NULL);
public: