]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: simplify peer code a bit
authorSage Weil <sage@newdream.net>
Fri, 12 Dec 2008 23:02:55 +0000 (15:02 -0800)
committerSage Weil <sage@newdream.net>
Fri, 12 Dec 2008 23:12:49 +0000 (15:12 -0800)
Combine the two loops.

src/osd/PG.cc

index cbcd403e04b1ba2db22f62838c0be70432f8d17c..3b78e1de04a50982a86f457733a8d3cf8b65f56e 100644 (file)
@@ -1090,9 +1090,14 @@ void PG::peer(ObjectStore::Transaction& t,
   */  
 
   // gather missing from peers
+  bool have_all_missing = true;
   for (unsigned i=1; i<acting.size(); i++) {
     int peer = acting[i];
     if (peer_info[peer].is_empty()) continue;
+    if (peer_missing.count(peer) == 0) {
+      dout(10) << " still need log+missing from osd" << peer << dendl;
+      have_all_missing = false;
+    }
     if (peer_log_requested.count(peer) ||
         peer_summary_requested.count(peer)) continue;
 
@@ -1101,18 +1106,8 @@ void PG::peer(ObjectStore::Transaction& t,
     query_map[peer][info.pgid] = Query(Query::FULLLOG, info.history);
     peer_log_requested.insert(peer);
   }
-
-  // did we get them all?
-  bool have_missing = true;
-  for (unsigned i=1; i<acting.size(); i++) {
-    int peer = acting[i];
-    if (peer_info[peer].is_empty()) continue;
-    if (peer_missing.count(peer)) continue;
-    
-    dout(10) << " waiting for log+missing from osd" << peer << dendl;
-    have_missing = false;
-  }
-  if (!have_missing) return;
+  if (!have_all_missing)
+    return;
 
   dout(10) << " peers_complete_thru " << peers_complete_thru << dendl;