summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-01-21 20:55:20 -0800
committerSage Weil <sage@inktank.com>2013-01-22 14:47:42 -0800
commit23c02bce90c9725ccaf4295de3177e8146157723 (patch)
tree5e3568c3c60110f8ecf847428a62e4a54f92ea60
parenta1137eb3e168c2d00f93789e4d565c1584790df0 (diff)
downloadceph-23c02bce90c9725ccaf4295de3177e8146157723.tar.gz
osd: refactor ReplicatedPG::do_sub_op
PULL is the only case where we don't wait for active. Signed-off-by: Sage Weil <sage@inktank.com>
-rw-r--r--src/osd/ReplicatedPG.cc50
1 files changed, 20 insertions, 30 deletions
diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc
index 09d02da7f95..396a148ae9c 100644
--- a/src/osd/ReplicatedPG.cc
+++ b/src/osd/ReplicatedPG.cc
@@ -1086,55 +1086,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)