Skip to content

Commit

Permalink
osd: Allow get_hash_info to use attrs map if available
Browse files Browse the repository at this point in the history
Signed-off-by: David Zafman <dzafman@redhat.com>
  • Loading branch information
dzafman committed Jan 4, 2016
1 parent ca81563 commit 5c999b1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
29 changes: 21 additions & 8 deletions src/osd/ECBackend.cc
Expand Up @@ -1703,7 +1703,7 @@ void ECBackend::start_remaining_read_op(
}

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);
Expand All @@ -1719,12 +1719,25 @@ ECUtil::HashInfoRef ECBackend::get_hash_info(
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) {
Expand Down Expand Up @@ -2092,7 +2105,7 @@ void ECBackend::be_deep_scrub(
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;
Expand Down
3 changes: 2 additions & 1 deletion src/osd/ECBackend.h
Expand Up @@ -456,7 +456,8 @@ class ECBackend : public PGBackend {
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);
Expand Down

0 comments on commit 5c999b1

Please sign in to comment.