]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: Allow get_hash_info to use attrs map if available 6669/head
authorDavid Zafman <dzafman@redhat.com>
Thu, 10 Dec 2015 23:36:41 +0000 (15:36 -0800)
committerDavid Zafman <dzafman@redhat.com>
Mon, 4 Jan 2016 19:19:50 +0000 (11:19 -0800)
Signed-off-by: David Zafman <dzafman@redhat.com>
src/osd/ECBackend.cc
src/osd/ECBackend.h

index e8d26eb4e31d1004540d805d591eea0895f2deeb..dadfeaa0b71475de85093b5ad066e5a1b413bd7f 100644 (file)
@@ -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);
@@ -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) {
@@ -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;
index efb284e2d73f8acecd6298a9b5f0108f09404be8..bb064f8496512f754061df1ba434b11312f3b8c1 100644 (file)
@@ -456,7 +456,8 @@ public:
   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);