From 1a0360cbcc063b56ba303c5b0ec1053c5e95be5e Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Fri, 23 Mar 2012 22:23:06 -0700 Subject: [PATCH] osd/: OpRequest is no longer a RefCountedObject, remove puts/gets Signed-off-by: Samuel Just --- src/osd/OSD.cc | 40 +--------------------------------------- src/osd/OpRequest.h | 2 +- src/osd/PG.cc | 17 +---------------- src/osd/ReplicatedPG.cc | 18 ------------------ src/osd/ReplicatedPG.h | 6 ------ 5 files changed, 3 insertions(+), 80 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index d7ecc1b84cc34..7ef3b8d7f461c 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -3652,7 +3652,6 @@ void OSD::advance_map(ObjectStore::Transaction& t, C_Contexts *tfin) } else { dout(10) << " discarding waiting ops for " << pgid << dendl; while (!p->second.empty()) { - p->second.front()->put(); p->second.pop_front(); } waiting_for_pg.erase(p++); @@ -3922,7 +3921,6 @@ bool OSD::require_osd_peer(OpRequestRef op) if (!op->request->get_connection()->peer_is_osd()) { dout(0) << "require_osd_peer received from non-osd " << op->request->get_connection()->get_peer_addr() << " " << *op->request << dendl; - op->put(); return false; } return true; @@ -3946,7 +3944,6 @@ bool OSD::require_same_or_newer_map(OpRequestRef op, epoch_t epoch) if (epoch < up_epoch) { dout(7) << "from pre-up epoch " << epoch << " < " << up_epoch << dendl; - op->put(); return false; } @@ -3963,7 +3960,6 @@ bool OSD::require_same_or_newer_map(OpRequestRef op, epoch_t epoch) cluster_messenger->mark_down_on_empty(con); cluster_messenger->mark_disposable(con); - op->put(); return false; } } @@ -3971,7 +3967,6 @@ bool OSD::require_same_or_newer_map(OpRequestRef op, epoch_t epoch) // ok, we have at least as new a map as they do. are we (re)booting? if (!is_active()) { dout(7) << "still in boot state, dropping message " << *m << dendl; - op->put(); return false; } @@ -4172,7 +4167,6 @@ void OSD::handle_pg_create(OpRequestRef op) if (!require_mon_peer(op->request)) { // we have to hack around require_mon_peer's interface limits op->request = NULL; - op->put(); return; } @@ -4279,8 +4273,6 @@ void OSD::handle_pg_create(OpRequestRef op) do_infos(info_map); maybe_update_heartbeat_peers(); - - op->put(); } @@ -4403,8 +4395,6 @@ void OSD::handle_pg_notify(OpRequestRef op) do_infos(info_map); maybe_update_heartbeat_peers(); - - op->put(); } void OSD::handle_pg_log(OpRequestRef op) @@ -4425,7 +4415,6 @@ void OSD::handle_pg_log(OpRequestRef op) PG *pg = get_or_create_pg(m->info, m->get_epoch(), from, created, false, &t, &fin); if (!pg) { - op->put(); return; } @@ -4451,8 +4440,6 @@ void OSD::handle_pg_log(OpRequestRef op) assert(!tr); maybe_update_heartbeat_peers(); - - op->put(); } void OSD::handle_pg_info(OpRequestRef op) @@ -4504,8 +4491,6 @@ void OSD::handle_pg_info(OpRequestRef op) do_infos(info_map); maybe_update_heartbeat_peers(); - - op->put(); } void OSD::handle_pg_trim(OpRequestRef op) @@ -4530,7 +4515,7 @@ void OSD::handle_pg_trim(OpRequestRef op) if (m->epoch < pg->info.history.same_interval_since) { dout(10) << *pg << " got old trim to " << m->trim_to << ", ignoring" << dendl; pg->unlock(); - goto out; + return; } assert(pg); @@ -4552,9 +4537,6 @@ void OSD::handle_pg_trim(OpRequestRef op) } pg->unlock(); } - - out: - op->put(); } void OSD::handle_pg_scan(OpRequestRef op) @@ -4571,7 +4553,6 @@ void OSD::handle_pg_scan(OpRequestRef op) PG *pg; if (!_have_pg(m->pgid)) { - op->put(); return; } @@ -4592,7 +4573,6 @@ bool OSD::scan_is_queueable(PG *pg, OpRequestRef op) if (m->query_epoch < pg->info.history.same_interval_since) { dout(10) << *pg << " got old scan, ignoring" << dendl; - op->put(); return false; } @@ -4613,7 +4593,6 @@ void OSD::handle_pg_backfill(OpRequestRef op) PG *pg; if (!_have_pg(m->pgid)) { - op->put(); return; } @@ -4634,7 +4613,6 @@ bool OSD::backfill_is_queueable(PG *pg, OpRequestRef op) if (m->query_epoch < pg->info.history.same_interval_since) { dout(10) << *pg << " got old backfill, ignoring" << dendl; - op->put(); return false; } @@ -4668,8 +4646,6 @@ void OSD::handle_pg_missing(OpRequestRef op) do_queries(query_map); maybe_update_heartbeat_peers(); - - op->put(); #endif } @@ -4774,8 +4750,6 @@ void OSD::handle_pg_query(OpRequestRef op) } do_notifies(notify_list, m->get_epoch()); - - op->put(); } @@ -4820,7 +4794,6 @@ void OSD::handle_pg_remove(OpRequestRef op) } pg->unlock(); } - op->put(); } @@ -5187,7 +5160,6 @@ void OSD::reply_op_error(OpRequestRef op, int err, eversion_t v) if (m->get_source().is_osd()) msgr = cluster_messenger; msgr->send_message(reply, m->get_connection()); - op->put(); } void OSD::handle_misdirected_op(PG *pg, OpRequestRef op) @@ -5197,7 +5169,6 @@ void OSD::handle_misdirected_op(PG *pg, OpRequestRef op) if (pg) { if (m->get_map_epoch() < pg->info.history.same_primary_since) { dout(7) << *pg << " changed after " << m->get_map_epoch() << ", dropping" << dendl; - op->put(); return; } else { dout(7) << *pg << " misdirected op in " << m->get_map_epoch() << dendl; @@ -5223,7 +5194,6 @@ void OSD::handle_op(OpRequestRef op) MOSDOp *m = (MOSDOp*)op->request; assert(m->get_header().type == CEPH_MSG_OSD_OP); if (op_is_discardable(m)) { - op->put(); return; } @@ -5304,7 +5274,6 @@ void OSD::handle_op(OpRequestRef op) // okay, we aren't valid now; check send epoch if (m->get_map_epoch() >= superblock.oldest_map) { dout(7) << "don't have sender's osdmap; assuming it was valid and that client will resend" << dendl; - op->put(); return; } OSDMapRef send_map = get_map(m->get_map_epoch()); @@ -5317,7 +5286,6 @@ void OSD::handle_op(OpRequestRef op) if (send_map->get_pg_role(m->get_pg(), whoami) >= 0) { dout(7) << "dropping request; client will resend when they get new map" << dendl; - op->put(); } else { dout(7) << "we are invalid target" << dendl; handle_misdirected_op(NULL, op); @@ -5370,7 +5338,6 @@ void OSD::handle_sub_op(OpRequestRef op) dout(10) << "handle_sub_op " << *m << " epoch " << m->map_epoch << dendl; if (m->map_epoch < up_epoch) { dout(3) << "replica op from before up" << dendl; - op->put(); return; } @@ -5393,7 +5360,6 @@ void OSD::handle_sub_op(OpRequestRef op) PG *pg = _have_pg(pgid) ? _lookup_lock_pg(pgid) : NULL; if (!pg) { - op->put(); return; } pg->get(); @@ -5408,7 +5374,6 @@ void OSD::handle_sub_op_reply(OpRequestRef op) assert(m->get_header().type == MSG_OSD_SUBOPREPLY); if (m->get_map_epoch() < up_epoch) { dout(3) << "replica op reply from before up" << dendl; - op->put(); return; } @@ -5430,7 +5395,6 @@ void OSD::handle_sub_op_reply(OpRequestRef op) PG *pg = _have_pg(pgid) ? _lookup_lock_pg(pgid) : NULL; if (!pg) { - op->put(); return; } pg->get(); @@ -5473,7 +5437,6 @@ bool OSD::op_is_queueable(PG *pg, OpRequestRef op) } if (op_is_discardable(m)) { - op->put(); return false; } @@ -5529,7 +5492,6 @@ bool OSD::subop_is_queueable(PG *pg, OpRequestRef op) dout(10) << "handle_sub_op pg changed " << pg->info.history << " after " << m->map_epoch << ", dropping" << dendl; - op->put(); return false; } diff --git a/src/osd/OpRequest.h b/src/osd/OpRequest.h index a83c84e18353a..e6b6b4effc6de 100644 --- a/src/osd/OpRequest.h +++ b/src/osd/OpRequest.h @@ -52,7 +52,7 @@ public: * you want to track, create an OpRequest with it, and then pass around that OpRequest * the way you used to pass around the Message. */ -struct OpRequest : public RefCountedObject { +struct OpRequest { friend class OpTracker; Message *request; xlist::item xitem; diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 5d08c6b8b8efe..48abb0ba5638b 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -1402,9 +1402,7 @@ void PG::do_request(OpRequestRef op) switch (op->request->get_type()) { case CEPH_MSG_OSD_OP: - if (osd->op_is_discardable((MOSDOp*)op->request)) - op->put(); - else + if (!osd->op_is_discardable((MOSDOp*)op->request)) do_op(op); // do it now break; @@ -2523,7 +2521,6 @@ void PG::sub_op_scrub_map(OpRequestRef op) if (m->map_epoch < info.history.same_interval_since) { dout(10) << "sub_op_scrub discarding old sub_op from " << m->map_epoch << " < " << info.history.same_interval_since << dendl; - op->put(); return; } @@ -2547,8 +2544,6 @@ void PG::sub_op_scrub_map(OpRequestRef op) assert(last_update_applied == info.last_update); osd->scrub_finalize_wq.queue(this); } - - op->put(); } /* @@ -2596,7 +2591,6 @@ void PG::sub_op_scrub_reserve(OpRequestRef op) if (scrub_reserved) { dout(10) << "Ignoring reserve request: Already reserved" << dendl; - op->put(); return; } @@ -2607,8 +2601,6 @@ void PG::sub_op_scrub_reserve(OpRequestRef op) MOSDSubOpReply *reply = new MOSDSubOpReply(m, 0, get_osdmap()->get_epoch(), CEPH_OSD_FLAG_ACK); ::encode(scrub_reserved, reply->get_data()); osd->cluster_messenger->send_message(reply, m->get_connection()); - - op->put(); } void PG::sub_op_scrub_reserve_reply(OpRequestRef op) @@ -2619,7 +2611,6 @@ void PG::sub_op_scrub_reserve_reply(OpRequestRef op) if (!scrub_reserved) { dout(10) << "ignoring obsolete scrub reserve reply" << dendl; - op->put(); return; } @@ -2643,8 +2634,6 @@ void PG::sub_op_scrub_reserve_reply(OpRequestRef op) } sched_scrub(); } - - op->put(); } void PG::sub_op_scrub_unreserve(OpRequestRef op) @@ -2655,8 +2644,6 @@ void PG::sub_op_scrub_unreserve(OpRequestRef op) op->mark_started(); clear_scrub_reserved(); - - op->put(); } void PG::sub_op_scrub_stop(OpRequestRef op) @@ -2672,8 +2659,6 @@ void PG::sub_op_scrub_stop(OpRequestRef op) MOSDSubOpReply *reply = new MOSDSubOpReply(m, 0, get_osdmap()->get_epoch(), CEPH_OSD_FLAG_ACK); osd->cluster_messenger->send_message(reply, m->get_connection()); - - op->put(); } void PG::clear_scrub_reserved() diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 971c906cf9c6a..4b7f3358e787f 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -541,7 +541,6 @@ void ReplicatedPG::do_pg_op(OpRequestRef op) reply->set_data(outdata); reply->set_result(result); osd->client_messenger->send_message(reply, m->get_connection()); - op->put(); delete filter; } @@ -786,7 +785,6 @@ void ReplicatedPG::do_op(OpRequestRef op) } else { dout(10) << "no src oid specified for multi op " << osd_op << dendl; osd->reply_op_error(op, -EINVAL); - op->put(); } put_object_contexts(src_obc); put_object_context(obc); @@ -933,7 +931,6 @@ void ReplicatedPG::do_op(OpRequestRef op) ctx->reply = NULL; reply->add_flags(CEPH_OSD_FLAG_ACK | CEPH_OSD_FLAG_ONDISK); osd->client_messenger->send_message(reply, m->get_connection()); - op->put(); delete ctx; put_object_context(obc); put_object_contexts(src_obc); @@ -1133,8 +1130,6 @@ void ReplicatedPG::do_scan(OpRequestRef op) } break; } - - op->put(); } void ReplicatedPG::do_backfill(OpRequestRef op) @@ -1181,8 +1176,6 @@ void ReplicatedPG::do_backfill(OpRequestRef op) } break; } - - op->put(); } /* Returns head of snap_trimq as snap_to_trim and the relevant objects as @@ -4194,7 +4187,6 @@ void ReplicatedPG::sub_op_modify_applied(RepModify *rm) unlock(); if (done) { delete rm->ctx; - rm->op->put(); delete rm; put(); } @@ -4226,7 +4218,6 @@ void ReplicatedPG::sub_op_modify_commit(RepModify *rm) unlock(); if (done) { delete rm->ctx; - rm->op->put(); delete rm; put(); } @@ -4250,8 +4241,6 @@ void ReplicatedPG::sub_op_modify_reply(OpRequestRef op) fromosd, r->get_last_complete_ondisk()); } - - op->put(); } @@ -5093,7 +5082,6 @@ void ReplicatedPG::sub_op_push_reply(OpRequestRef op) } } } - op->put(); } void ReplicatedPG::finish_degraded_object(const hobject_t& oid) @@ -5157,7 +5145,6 @@ void ReplicatedPG::sub_op_pull(OpRequestRef op) } log_subop_stats(op, 0, l_osd_sop_pull_lat); - op->put(); } @@ -5290,7 +5277,6 @@ void ReplicatedPG::sub_op_push(OpRequestRef op) } else { handle_push(op); } - op->put(); return; } @@ -5316,8 +5302,6 @@ void ReplicatedPG::_failed_push(OpRequestRef op) finish_recovery_op(soid); // close out this attempt, pull_from_peer[from].erase(soid); pulling.erase(soid); - - op->put(); } void ReplicatedPG::sub_op_remove(OpRequestRef op) @@ -5332,8 +5316,6 @@ void ReplicatedPG::sub_op_remove(OpRequestRef op) remove_object_with_snap_hardlinks(*t, m->poid); int r = osd->store->queue_transaction(&osr, t); assert(r == 0); - - op->put(); } diff --git a/src/osd/ReplicatedPG.h b/src/osd/ReplicatedPG.h index 1b5cb68687e7a..246e98f97e492 100644 --- a/src/osd/ReplicatedPG.h +++ b/src/osd/ReplicatedPG.h @@ -454,8 +454,6 @@ public: if (--nref == 0) { assert(!obc); assert(src_obc.empty()); - if (ctx->op) - ctx->op->put(); delete ctx; delete this; //generic_dout(0) << "deleting " << this << dendl; @@ -752,14 +750,10 @@ protected: epoch_t same_since; eversion_t last_complete; C_OSD_CommittedPushedObject(ReplicatedPG *p, OpRequestRef o, epoch_t ss, eversion_t lc) : pg(p), op(o), same_since(ss), last_complete(lc) { - if (op) - op->get(); pg->get(); } void finish(int r) { pg->_committed_pushed_object(op, same_since, last_complete); - if (op) - op->put(); } }; -- 2.39.5