From: Samuel Just Date: Thu, 16 Apr 2015 18:50:34 +0000 (-0700) Subject: ECBackend: eliminate transaction append, ECSubWrite copy X-Git-Tag: v9.0.2~87^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2738d02bef7972f55a3df45b5b1c841bd7738f40;p=ceph.git ECBackend: eliminate transaction append, ECSubWrite copy Update MOSDECSubOpWrite to claim passed ECSubWrite structure avoiding the copy. Update handle_sub_write to pass a transaction list to avoid the append. Signed-off-by: Samuel Just --- diff --git a/src/messages/MOSDECSubOpWrite.h b/src/messages/MOSDECSubOpWrite.h index a47bcef1f19e..b3a8e3cdb1f2 100644 --- a/src/messages/MOSDECSubOpWrite.h +++ b/src/messages/MOSDECSubOpWrite.h @@ -35,9 +35,10 @@ public: MOSDECSubOpWrite() : Message(MSG_OSD_EC_WRITE, HEAD_VERSION, COMPAT_VERSION) {} - MOSDECSubOpWrite(ECSubWrite &op) - : Message(MSG_OSD_EC_WRITE, HEAD_VERSION, COMPAT_VERSION), - op(op) {} + MOSDECSubOpWrite(ECSubWrite &in_op) + : Message(MSG_OSD_EC_WRITE, HEAD_VERSION, COMPAT_VERSION) { + op.claim(in_op); + } virtual void decode_payload() { bufferlist::iterator p = payload.begin(); diff --git a/src/osd/ECBackend.cc b/src/osd/ECBackend.cc index 845ea832eeb8..b04776c15c38 100644 --- a/src/osd/ECBackend.cc +++ b/src/osd/ECBackend.cc @@ -841,7 +841,6 @@ void ECBackend::handle_sub_write( get_parent()->whoami_shard().shard >= ec_impl->get_data_chunk_count()) op.t.set_fadvise_flag(CEPH_OSD_OP_FLAG_FADVISE_DONTNEED); - localt->append(op.t); if (on_local_applied_sync) { dout(10) << "Queueing onreadable_sync: " << on_local_applied_sync << dendl; localt->register_on_applied_sync(on_local_applied_sync); @@ -857,7 +856,13 @@ void ECBackend::handle_sub_write( new SubWriteApplied(this, msg, op.tid, op.at_version))); localt->register_on_applied( new ObjectStore::C_DeleteTransaction(localt)); - get_parent()->queue_transaction(localt, msg); + list tls; + tls.push_back(localt); + tls.push_back(new ObjectStore::Transaction); + tls.back()->swap(op.t); + tls.back()->register_on_complete( + new ObjectStore::C_DeleteTransaction(tls.back())); + get_parent()->queue_transactions(tls, msg); } void ECBackend::handle_sub_read( diff --git a/src/osd/ECMsgTypes.h b/src/osd/ECMsgTypes.h index 78193830959b..2d5dc751ee49 100644 --- a/src/osd/ECMsgTypes.h +++ b/src/osd/ECMsgTypes.h @@ -57,10 +57,29 @@ struct ECSubWrite { temp_added(temp_added), temp_removed(temp_removed), updated_hit_set_history(updated_hit_set_history) {} + void claim(ECSubWrite &other) { + from = other.from; + tid = other.tid; + reqid = other.reqid; + soid = other.soid; + stats = other.stats; + t.swap(other.t); + at_version = other.at_version; + trim_to = other.trim_to; + trim_rollback_to = other.trim_rollback_to; + log_entries.swap(other.log_entries); + temp_added.swap(other.temp_added); + temp_removed.swap(other.temp_removed); + updated_hit_set_history = other.updated_hit_set_history; + } void encode(bufferlist &bl) const; void decode(bufferlist::iterator &bl); void dump(Formatter *f) const; static void generate_test_instances(list& o); +private: + // no outside copying -- slow + ECSubWrite(ECSubWrite& other); + const ECSubWrite& operator=(const ECSubWrite& other); }; WRITE_CLASS_ENCODER(ECSubWrite) diff --git a/src/test/encoding/types.h b/src/test/encoding/types.h index ce099eb34c00..cb06b15f32e8 100644 --- a/src/test/encoding/types.h +++ b/src/test/encoding/types.h @@ -93,7 +93,7 @@ TYPE(PushReplyOp) TYPE(ECUtil::HashInfo) #include "osd/ECMsgTypes.h" -TYPE(ECSubWrite) +TYPE_NOCOPY(ECSubWrite) TYPE(ECSubWriteReply) TYPE_FEATUREFUL(ECSubRead) TYPE(ECSubReadReply)