]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ReplicatedPG: split handle_push_reply out of sub_op_push_reply
authorSamuel Just <sam.just@inktank.com>
Fri, 14 Jun 2013 22:35:55 +0000 (15:35 -0700)
committerSamuel Just <sam.just@inktank.com>
Mon, 8 Jul 2013 23:43:31 +0000 (16:43 -0700)
Signed-off-by: Samuel Just <sam.just@inktank.com>
src/osd/ReplicatedPG.cc
src/osd/ReplicatedPG.h

index fa5fa36ffecf35159077446587606676dc7e59af..7917bdcc59b731bf641905c99d950abddcd15482 100644 (file)
@@ -5902,21 +5902,33 @@ void ReplicatedPG::send_push_op_blank(const hobject_t& soid, int peer)
 void ReplicatedPG::sub_op_push_reply(OpRequestRef op)
 {
   MOSDSubOpReply *reply = static_cast<MOSDSubOpReply*>(op->request);
+  const hobject_t& soid = reply->get_poid();
   assert(reply->get_header().type == MSG_OSD_SUBOPREPLY);
   dout(10) << "sub_op_push_reply from " << reply->get_source() << " " << *reply << dendl;
+  int peer = reply->get_source().num();
 
   op->mark_started();
   
-  int peer = reply->get_source().num();
-  const hobject_t& soid = reply->get_poid();
-  
+  PushReplyOp rop;
+  rop.soid = soid;
+  PushOp pop;
+  bool more = handle_push_reply(peer, rop, &pop);
+  if (more)
+    send_push_op(pushing[soid][peer].priority, peer, pop);
+}
+
+bool ReplicatedPG::handle_push_reply(int peer, PushReplyOp &op, PushOp *reply)
+{
+  const hobject_t &soid = op.soid;
   if (pushing.count(soid) == 0) {
     dout(10) << "huh, i wasn't pushing " << soid << " to osd." << peer
             << ", or anybody else"
             << dendl;
+    return false;
   } else if (pushing[soid].count(peer) == 0) {
     dout(10) << "huh, i wasn't pushing " << soid << " to osd." << peer
             << dendl;
+    return false;
   } else {
     PushInfo *pi = &pushing[soid][peer];
 
@@ -5925,11 +5937,11 @@ void ReplicatedPG::sub_op_push_reply(OpRequestRef op)
               << pi->recovery_progress.data_recovered_to
               << " of " << pi->recovery_info.copy_subset << dendl;
       ObjectRecoveryProgress new_progress;
-      send_push(
-       pi->priority,
-       peer, pi->recovery_info,
-       pi->recovery_progress, &new_progress);
+      build_push_op(
+       pi->recovery_info,
+       pi->recovery_progress, &new_progress, reply);
       pi->recovery_progress = new_progress;
+      return true;
     } else {
       // done!
       if (peer == backfill_target && backfills_in_flight.count(soid))
@@ -5955,6 +5967,7 @@ void ReplicatedPG::sub_op_push_reply(OpRequestRef op)
        dout(10) << "pushed " << soid << ", still waiting for push ack from " 
                 << pushing[soid].size() << " others" << dendl;
       }
+      return false;
     }
   }
 }
index dd2ba7f3113668e52ed3af241e36cada63c02555..25a1ef0e40f1f4c81dfc60c05cdd104f45f69e9f 100644 (file)
@@ -897,6 +897,7 @@ protected:
   void sub_op_push(OpRequestRef op);
   void _failed_push(int from, const hobject_t &soid);
   void sub_op_push_reply(OpRequestRef op);
+  bool handle_push_reply(int peer, PushReplyOp &op, PushOp *reply);
   void sub_op_pull(OpRequestRef op);
 
   void log_subop_stats(OpRequestRef op, int tag_inb, int tag_lat);