From f13ddc8a2df401c37f6dc792eb93fc0cc45705e2 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 21 Jan 2013 20:55:20 -0800 Subject: [PATCH] osd: refactor ReplicatedPG::do_sub_op PULL is the only case where we don't wait for active. Signed-off-by: Sage Weil (cherry picked from commit 23c02bce90c9725ccaf4295de3177e8146157723) --- src/osd/ReplicatedPG.cc | 50 +++++++++++++++++------------------------ 1 file changed, 20 insertions(+), 30 deletions(-) diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 39909c8c2e66..4eda82e9d608 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -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) -- 2.47.3