]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: refactor ReplicatedPG::do_sub_op
authorSage Weil <sage@inktank.com>
Tue, 22 Jan 2013 04:55:20 +0000 (20:55 -0800)
committerSamuel Just <sam.just@inktank.com>
Sat, 26 Jan 2013 01:17:24 +0000 (17:17 -0800)
PULL is the only case where we don't wait for active.

Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit 23c02bce90c9725ccaf4295de3177e8146157723)

src/osd/ReplicatedPG.cc

index 39909c8c2e66609569d874765685aba90c11f2b5..4eda82e9d608d79866217d6470c9752c715599e6 100644 (file)
@@ -1085,55 +1085,45 @@ void ReplicatedPG::do_sub_op(OpRequestRef op)
   assert(m->get_header().type == MSG_OSD_SUBOP);
   dout(15) << "do_sub_op " << *op->request << dendl;
 
+  OSDOp *first = NULL;
   if (m->ops.size() >= 1) {
-    OSDOp& first = m->ops[0];
-    switch (first.op.op) {
+    first = &m->ops[0];
+    switch (first->op.op) {
     case CEPH_OSD_OP_PULL:
       sub_op_pull(op);
       return;
+    }
+  }
+
+  if (!is_active()) {
+    waiting_for_active.push_back(op);
+    return;
+  }
+
+  if (first) {
+    switch (first->op.op) {
     case CEPH_OSD_OP_PUSH:
-      if (!is_active())
-       waiting_for_active.push_back(op);
-      else
-       sub_op_push(op);
+      sub_op_push(op);
       return;
     case CEPH_OSD_OP_DELETE:
-      if (!is_active())
-       waiting_for_active.push_back(op);
-      else
-       sub_op_remove(op);
+      sub_op_remove(op);
       return;
     case CEPH_OSD_OP_SCRUB_RESERVE:
-      if (!is_active())
-       waiting_for_active.push_back(op);
-      else
-       sub_op_scrub_reserve(op);
+      sub_op_scrub_reserve(op);
       return;
     case CEPH_OSD_OP_SCRUB_UNRESERVE:
-      if (!is_active())
-       waiting_for_active.push_back(op);
-      else
-       sub_op_scrub_unreserve(op);
+      sub_op_scrub_unreserve(op);
       return;
     case CEPH_OSD_OP_SCRUB_STOP:
-      if (!is_active())
-       waiting_for_active.push_back(op);
-      else
-       sub_op_scrub_stop(op);
+      sub_op_scrub_stop(op);
       return;
     case CEPH_OSD_OP_SCRUB_MAP:
-      if (!is_active())
-       waiting_for_active.push_back(op);
-      else
-       sub_op_scrub_map(op);
+      sub_op_scrub_map(op);
       return;
     }
   }
 
-  if (!is_active())
-    waiting_for_active.push_back(op);
-  else
-    sub_op_modify(op);
+  sub_op_modify(op);
 }
 
 void ReplicatedPG::do_sub_op_reply(OpRequestRef op)