]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ObjectStore: improve name of the queue_transaction which cleans up the transaction
authorSamuel Just <sam.just@inktank.com>
Tue, 15 Oct 2013 02:13:19 +0000 (19:13 -0700)
committerSamuel Just <sam.just@inktank.com>
Wed, 22 Jan 2014 22:38:25 +0000 (14:38 -0800)
Signed-off-by: Samuel Just <sam.just@inktank.com>
src/os/ObjectStore.h
src/osd/OSD.cc
src/osd/PG.cc
src/osd/ReplicatedPG.cc

index 17d360f0b4369dedceaedb1a4a971f48e98f3017..5498ca8d868fc2946749bd19adb4beef7f52ce2d 100644 (file)
@@ -783,8 +783,8 @@ public:
   }
   unsigned apply_transactions(Sequencer *osr, list<Transaction*>& tls, Context *ondisk=0);
 
-  int queue_transaction(Sequencer *osr, Transaction* t,
-                        ThreadPool::TPHandle *handle = NULL) {
+  int queue_transaction_and_cleanup(Sequencer *osr, Transaction* t,
+                                   ThreadPool::TPHandle *handle = NULL) {
     list<Transaction *> tls;
     tls.push_back(t);
     return queue_transactions(osr, tls, new C_DeleteTransaction(t),
index 2537371d8d0cfbc8e26aded85486004f5dcbd62a..5bcf0687672d72ed6aad355243f6a24175e2d541 100644 (file)
@@ -645,7 +645,7 @@ int OSD::mkfs(CephContext *cct, ObjectStore *store, const string &dev,
        for (int i=0; i<1000; i++) {
          ObjectStore::Transaction *t = new ObjectStore::Transaction;
          t->write(coll_t::META_COLL, hobject_t(sobject_t(oid, 0)), i*bl.length(), bl.length(), bl);
-         store->queue_transaction(NULL, t);
+         store->queue_transaction_and_cleanup(NULL, t);
        }
        store->sync();
        utime_t end = ceph_clock_now(cct);
@@ -4120,14 +4120,14 @@ void OSD::do_command(Connection *con, tid_t tid, vector<string>& cmd, bufferlist
       hobject_t soid(sobject_t(oid, 0));
       ObjectStore::Transaction *t = new ObjectStore::Transaction;
       t->write(coll_t::META_COLL, soid, 0, bsize, bl);
-      store->queue_transaction(NULL, t);
+      store->queue_transaction_and_cleanup(NULL, t);
       cleanupt->remove(coll_t::META_COLL, soid);
     }
     store->sync_and_flush();
     utime_t end = ceph_clock_now(cct);
 
     // clean up
-    store->queue_transaction(NULL, cleanupt);
+    store->queue_transaction_and_cleanup(NULL, cleanupt);
 
     uint64_t rate = (double)count / (end - start);
     if (f) {
@@ -6382,8 +6382,9 @@ void OSD::handle_pg_trim(OpRequestRef op)
       pg->pg_log.trim(m->trim_to, pg->info);
       pg->dirty_info = true;
       pg->write_if_dirty(*t);
-      int tr = store->queue_transaction(pg->osr.get(), t,
-                                       new ObjectStore::C_DeleteTransaction(t));
+      int tr = store->queue_transaction(
+       pg->osr.get(), t,
+       new ObjectStore::C_DeleteTransaction(t));
       assert(tr == 0);
     }
     pg->unlock();
index 5e9dd7bbbf8fb61082d6a512c11e8236dbdde3e2..c5470518d0f43bba8df81e27b8dbb6b6a659bff3 100644 (file)
@@ -1499,7 +1499,7 @@ void PG::_activate_committed(epoch_t e)
   if (dirty_info) {
     ObjectStore::Transaction *t = new ObjectStore::Transaction;
     write_if_dirty(*t);
-    int tr = osd->store->queue_transaction(osr.get(), t);
+    int tr = osd->store->queue_transaction_and_cleanup(osr.get(), t);
     assert(tr == 0);
   }
 
@@ -4241,7 +4241,7 @@ void PG::scrub_finish()
     ObjectStore::Transaction *t = new ObjectStore::Transaction;
     dirty_info = true;
     write_if_dirty(*t);
-    int tr = osd->store->queue_transaction(osr.get(), t);
+    int tr = osd->store->queue_transaction_and_cleanup(osr.get(), t);
     assert(tr == 0);
   }
 
index f388d80a944224ed313295bdb4c0e3cba050981e..2e2e14872c1b8f35458fb283d3a02f337452eef4 100644 (file)
@@ -1927,6 +1927,8 @@ void ReplicatedBackend::_do_push(OpRequestRef op)
     new C_OSD_SendMessageOnConn(
       osd, reply, m->get_connection()));
 
+  t->register_on_applied(
+    new ObjectStore::C_DeleteTransaction(t));
   get_parent()->queue_transaction(t);
 }
 
@@ -1999,6 +2001,8 @@ void ReplicatedBackend::_do_pull_response(OpRequestRef op)
        osd, reply, m->get_connection()));
   }
 
+  t->register_on_applied(
+    new ObjectStore::C_DeleteTransaction(t));
   get_parent()->queue_transaction(t);
 }
 
@@ -2080,7 +2084,7 @@ void ReplicatedPG::do_backfill(OpRequestRef op)
       ObjectStore::Transaction *t = new ObjectStore::Transaction;
       dirty_info = true;
       write_if_dirty(*t);
-      int tr = osd->store->queue_transaction(osr.get(), t);
+      int tr = osd->store->queue_transaction_and_cleanup(osr.get(), t);
       assert(tr == 0);
     }
     break;
@@ -8131,7 +8135,7 @@ void ReplicatedPG::sub_op_remove(OpRequestRef op)
 
   ObjectStore::Transaction *t = new ObjectStore::Transaction;
   remove_snap_mapped_object(*t, m->poid);
-  int r = osd->store->queue_transaction(osr.get(), t);
+  int r = osd->store->queue_transaction_and_cleanup(osr.get(), t);
   assert(r == 0);
 }
 
@@ -10225,7 +10229,7 @@ boost::statechart::result ReplicatedPG::WaitingOnReplicas::react(const SnapTrim&
   ObjectStore::Transaction *t = new ObjectStore::Transaction;
   pg->dirty_big_info = true;
   pg->write_if_dirty(*t);
-  int tr = pg->osd->store->queue_transaction(pg->osr.get(), t);
+  int tr = pg->osd->store->queue_transaction_and_cleanup(pg->osr.get(), t);
   assert(tr == 0);
 
   context<SnapTrimmer>().need_share_pg_info = true;