]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ECBackend: eliminate transaction append, ECSubWrite copy
authorSamuel Just <sjust@redhat.com>
Thu, 16 Apr 2015 18:50:34 +0000 (11:50 -0700)
committerSamuel Just <sjust@redhat.com>
Mon, 11 May 2015 17:42:26 +0000 (10:42 -0700)
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 <sjust@redhat.com>
src/messages/MOSDECSubOpWrite.h
src/osd/ECBackend.cc
src/osd/ECMsgTypes.h
src/test/encoding/types.h

index a47bcef1f19e8e3e40c7aa43f1ac221f5bcc281d..b3a8e3cdb1f2d6fdd9651aa99086dc3fccfe5ffb 100644 (file)
@@ -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();
index 845ea832eeb80e9a0dba9d7d925f0e8397b75886..b04776c15c384fa07d9fb642fcf609fd5a17b59c 100644 (file)
@@ -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<ObjectStore::Transaction*> 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(
index 78193830959b178ae237b705887ae37aff1282c1..2d5dc751ee49b5feb5a7d534e4b545460e216462 100644 (file)
@@ -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<ECSubWrite*>& o);
+private:
+  // no outside copying -- slow
+  ECSubWrite(ECSubWrite& other);
+  const ECSubWrite& operator=(const ECSubWrite& other);
 };
 WRITE_CLASS_ENCODER(ECSubWrite)
 
index ce099eb34c0028de661806902e07f8f605a92dd9..cb06b15f32e808f1cdf098dffdc7a4b3b4936e8e 100644 (file)
@@ -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)