]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osd/PG: add new have_unfound() function in MissingLoc
authorhuangjun <hjwsm1989@gmail.com>
Mon, 26 Dec 2016 11:36:26 +0000 (19:36 +0800)
committerhuangjun <hjwsm1989@gmail.com>
Mon, 26 Dec 2016 11:43:38 +0000 (19:43 +0800)
          No need to lookup all objects in needs_recovery_map if only want to
          know whether if there are unfound objects.

Signed-off-by: huangjun <hjwsm1989@gmail.com>
src/osd/PG.h

index 883af9158d1b351c8d1472e88f32a7e823b7a42e..5860e267eeaeb61165e493a72ca0669f50a7f151 100644 (file)
@@ -376,6 +376,16 @@ public:
       return ret;
     }
 
+    bool have_unfound() const {
+      for (map<hobject_t, pg_missing_item, hobject_t::BitwiseComparator>::const_iterator i =
+            needs_recovery_map.begin();
+          i != needs_recovery_map.end();
+          ++i) {
+       if (is_unfound(i->first))
+         return true;
+      }
+      return false;
+    }
     void clear() {
       needs_recovery_map.clear();
       missing_loc.clear();
@@ -1041,7 +1051,7 @@ public:
   void proc_primary_info(ObjectStore::Transaction &t, const pg_info_t &info);
 
   bool have_unfound() const { 
-    return missing_loc.num_unfound() > 0;
+    return missing_loc.have_unfound();
   }
   int get_num_unfound() const {
     return missing_loc.num_unfound();