From 69682ad8373ef2fe8d73197f0674b732559f543a Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Thu, 15 Apr 2010 13:38:19 -0700 Subject: [PATCH] osd: send_message via Connection when possible --- src/osd/ReplicatedPG.cc | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index dc79002737e05..439075b93724b 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -443,7 +443,12 @@ void ReplicatedPG::do_pg_op(MOSDOp *op) CEPH_OSD_FLAG_ACK | CEPH_OSD_FLAG_ONDISK); reply->set_data(outdata); reply->set_result(result); - osd->messenger->send_message(reply, op->get_orig_source_inst()); + //if the message came from an OSD, it needs to go back to originator, + //but if the connection ISN't an OSD that connection is the originator + if (op->get_connection()->get_peer_type() != CEPH_ENTITY_TYPE_OSD) + osd->messenger->send_message(reply, op->get_connection()); + else + osd->messenger->send_message(reply, op->get_orig_source_inst()); op->put(); } @@ -601,7 +606,12 @@ void ReplicatedPG::do_op(MOSDOp *op) reply->set_data(ctx->outdata); reply->get_header().data_off = ctx->data_off; reply->set_result(result); - osd->messenger->send_message(reply, op->get_orig_source_inst()); + //if the message came from an OSD, it needs to go back to originator, + //but if the connection ISN't an OSD that connection is the originator + if (op->get_connection()->get_peer_type() != CEPH_ENTITY_TYPE_OSD) + osd->messenger->send_message(reply, op->get_connection()); + else + osd->messenger->send_message(reply, op->get_orig_source_inst()); op->put(); delete ctx; put_object_context(obc); @@ -1901,7 +1911,12 @@ void ReplicatedPG::eval_repop(RepGather *repop) // send commit. MOSDOpReply *reply = new MOSDOpReply(op, 0, osd->osdmap->get_epoch(), CEPH_OSD_FLAG_ONDISK); dout(10) << " sending commit on " << *repop << " " << reply << dendl; - osd->messenger->send_message(reply, op->get_orig_source_inst()); + //if the message came from an OSD, it needs to go back to originator, + //but if the connection ISN't an OSD that connection is the originator + if (op->get_connection()->get_peer_type() != CEPH_ENTITY_TYPE_OSD) + osd->messenger->send_message(reply, op->get_connection()); + else + osd->messenger->send_message(reply, op->get_orig_source_inst()); repop->sent_disk = true; } @@ -1923,7 +1938,12 @@ void ReplicatedPG::eval_repop(RepGather *repop) // send ack MOSDOpReply *reply = new MOSDOpReply(op, 0, osd->osdmap->get_epoch(), CEPH_OSD_FLAG_ACK); dout(10) << " sending ack on " << *repop << " " << reply << dendl; - osd->messenger->send_message(reply, op->get_orig_source_inst()); + //if the message came from an OSD, it needs to go back to originator, + //but if the connection ISN't an OSD that connection is the originator + if (op->get_connection()->get_peer_type() != CEPH_ENTITY_TYPE_OSD) + osd->messenger->send_message(reply, op->get_connection()); + else + osd->messenger->send_message(reply, op->get_orig_source_inst()); repop->sent_ack = true; } @@ -3194,7 +3214,7 @@ void ReplicatedPG::sub_op_push(MOSDSubOp *op) } else { // ack if i'm a replica and being pushed to. MOSDSubOpReply *reply = new MOSDSubOpReply(op, 0, osd->osdmap->get_epoch(), CEPH_OSD_FLAG_ACK); - osd->messenger->send_message(reply, op->get_source_inst()); + osd->messenger->send_message(reply, op->get_connection()); } // kick waiters -- 2.39.5