]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/: pass log_entries in write path as const ref
authorSamuel Just <sjust@redhat.com>
Thu, 11 Dec 2014 19:22:55 +0000 (11:22 -0800)
committerSamuel Just <sjust@redhat.com>
Thu, 22 Jan 2015 21:11:50 +0000 (13:11 -0800)
We need to use them after the submit_transaction call, so
we can't pass them by non-const ref.

Signed-off-by: Samuel Just <sjust@redhat.com>
src/osd/ECBackend.cc
src/osd/ECBackend.h
src/osd/PG.cc
src/osd/PG.h
src/osd/PGBackend.h
src/osd/PGLog.h
src/osd/ReplicatedBackend.cc
src/osd/ReplicatedBackend.h
src/osd/ReplicatedPG.cc
src/osd/ReplicatedPG.h

index 817cda00f02b6e592a40e9ccbcc1f92aea8b9eb3..ee994b666846804b045527c8a1dbc64236e50a4e 100644 (file)
@@ -1222,7 +1222,7 @@ void ECBackend::submit_transaction(
   PGTransaction *_t,
   const eversion_t &trim_to,
   const eversion_t &trim_rollback_to,
-  vector<pg_log_entry_t> &log_entries,
+  const vector<pg_log_entry_t> &log_entries,
   boost::optional<pg_hit_set_history_t> &hset_history,
   Context *on_local_applied_sync,
   Context *on_all_applied,
@@ -1238,7 +1238,7 @@ void ECBackend::submit_transaction(
   op->version = at_version;
   op->trim_to = trim_to;
   op->trim_rollback_to = trim_rollback_to;
-  op->log_entries.swap(log_entries);
+  op->log_entries = log_entries;
   std::swap(op->updated_hit_set_history, hset_history);
   op->on_local_applied_sync = on_local_applied_sync;
   op->on_all_applied = on_all_applied;
index d13d8bb4857556c0eafb3747c47e4e45f3ba9d28..04e9beb6124c3e6d77debccbaecd3d8143edf468 100644 (file)
@@ -98,7 +98,7 @@ public:
     PGTransaction *t,
     const eversion_t &trim_to,
     const eversion_t &trim_rollback_to,
-    vector<pg_log_entry_t> &log_entries,
+    const vector<pg_log_entry_t> &log_entries,
     boost::optional<pg_hit_set_history_t> &hset_history,
     Context *on_local_applied_sync,
     Context *on_all_applied,
index 2b52b4c23f76234a03971376a6b3f95f86190317..3325b4c66785d3952055c0865209954a58820a2c 100644 (file)
@@ -2843,7 +2843,7 @@ void PG::trim_peers()
   }
 }
 
-void PG::add_log_entry(pg_log_entry_t& e, bufferlist& log_bl)
+void PG::add_log_entry(const pg_log_entry_t& e, bufferlist& log_bl)
 {
   // raise last_complete only if we were previously up to date
   if (info.last_complete == info.last_update)
@@ -2867,7 +2867,7 @@ void PG::add_log_entry(pg_log_entry_t& e, bufferlist& log_bl)
 
 
 void PG::append_log(
-  vector<pg_log_entry_t>& logv,
+  const vector<pg_log_entry_t>& logv,
   eversion_t trim_to,
   eversion_t trim_rollback_to,
   ObjectStore::Transaction &t,
@@ -2878,7 +2878,7 @@ void PG::append_log(
   dout(10) << "append_log " << pg_log.get_log() << " " << logv << dendl;
 
   map<string,bufferlist> keys;
-  for (vector<pg_log_entry_t>::iterator p = logv.begin();
+  for (vector<pg_log_entry_t>::const_iterator p = logv.begin();
        p != logv.end();
        ++p) {
     add_log_entry(*p, keys[p->get_key_name()]);
@@ -3050,10 +3050,10 @@ void PG::log_weirdness()
 }
 
 void PG::update_snap_map(
-  vector<pg_log_entry_t> &log_entries,
+  const vector<pg_log_entry_t> &log_entries,
   ObjectStore::Transaction &t)
 {
-  for (vector<pg_log_entry_t>::iterator i = log_entries.begin();
+  for (vector<pg_log_entry_t>::const_iterator i = log_entries.begin();
        i != log_entries.end();
        ++i) {
     OSDriver::OSTransaction _t(osdriver.get_transaction(&t));
@@ -3066,7 +3066,8 @@ void PG::update_snap_map(
       } else {
        assert(i->snaps.length() > 0);
        vector<snapid_t> snaps;
-       bufferlist::iterator p = i->snaps.begin();
+       bufferlist snapbl = i->snaps;
+       bufferlist::iterator p = snapbl.begin();
        try {
          ::decode(snaps, p);
        } catch (...) {
index 2c3b5d4a49635ede4600d5ab42573900c0d61b7c..e269596855b37bda04f30e1927150602739bae18 100644 (file)
@@ -2120,9 +2120,9 @@ public:
     return at_version;
   }
 
-  void add_log_entry(pg_log_entry_t& e, bufferlist& log_bl);
+  void add_log_entry(const pg_log_entry_t& e, bufferlist& log_bl);
   void append_log(
-    vector<pg_log_entry_t>& logv,
+    const vector<pg_log_entry_t>& logv,
     eversion_t trim_to,
     eversion_t trim_rollback_to,
     ObjectStore::Transaction &t,
@@ -2139,7 +2139,7 @@ public:
   static bool _has_removal_flag(ObjectStore *store, spg_t pgid);
   static epoch_t peek_map_epoch(ObjectStore *store, spg_t pgid, bufferlist *bl);
   void update_snap_map(
-    vector<pg_log_entry_t> &log_entries,
+    const vector<pg_log_entry_t> &log_entries,
     ObjectStore::Transaction& t);
 
   void filter_snapc(vector<snapid_t> &snaps);
index 2ff352bc7a1ed15156ce9e43b361f44fb5f1e807..528a59e127f2416153deb0fa25d694cfaffb78ea 100644 (file)
        const hobject_t &hoid) = 0;
 
      virtual void log_operation(
-       vector<pg_log_entry_t> &logv,
+       const vector<pg_log_entry_t> &logv,
        boost::optional<pg_hit_set_history_t> &hset_history,
        const eversion_t &trim_to,
        const eversion_t &trim_rollback_to,
      PGTransaction *t,                    ///< [in] trans to execute
      const eversion_t &trim_to,           ///< [in] trim log to here
      const eversion_t &trim_rollback_to,  ///< [in] trim rollback info to here
-     vector<pg_log_entry_t> &log_entries, ///< [in] log entries for t
+     const vector<pg_log_entry_t> &log_entries, ///< [in] log entries for t
      /// [in] hitset history (if updated with this transaction)
      boost::optional<pg_hit_set_history_t> &hset_history,
      Context *on_local_applied_sync,      ///< [in] called when applied locally
index ac2f4b3563ced6ec4790c68d3eb63484c875d0ba..b6254ea060f9113450952a204590fe96936be971 100644 (file)
@@ -175,7 +175,7 @@ struct PGLog {
     }
 
     // actors
-    void add(pg_log_entry_t& e) {
+    void add(const pg_log_entry_t& e) {
       // add to log
       log.push_back(e);
 
@@ -355,7 +355,7 @@ public:
 
   void unindex() { log.unindex(); }
 
-  void add(pg_log_entry_t& e) {
+  void add(const pg_log_entry_t& e) {
     mark_writeout_from(e.version);
     log.add(e);
   }
index d15267291f8069a0267beb10420c542bdf307365..5e29c6e4bc6e9f6923a3026dc7c830966df0530d 100644 (file)
@@ -522,7 +522,7 @@ void ReplicatedBackend::submit_transaction(
   PGTransaction *_t,
   const eversion_t &trim_to,
   const eversion_t &trim_rollback_to,
-  vector<pg_log_entry_t> &log_entries,
+  const vector<pg_log_entry_t> &log_entries,
   boost::optional<pg_hit_set_history_t> &hset_history,
   Context *on_local_applied_sync,
   Context *on_all_acked,
index 6784bdffc284f32c9ba436c0615a589aa5decc38..7ce90da1e500d57cc0ef80fa5e527562884735c5 100644 (file)
@@ -344,7 +344,7 @@ public:
     PGTransaction *t,
     const eversion_t &trim_to,
     const eversion_t &trim_rollback_to,
-    vector<pg_log_entry_t> &log_entries,
+    const vector<pg_log_entry_t> &log_entries,
     boost::optional<pg_hit_set_history_t> &hset_history,
     Context *on_local_applied_sync,
     Context *on_all_applied,
@@ -365,7 +365,7 @@ private:
     eversion_t pg_trim_rollback_to,
     hobject_t new_temp_oid,
     hobject_t discard_temp_oid,
-    vector<pg_log_entry_t> &log_entries,
+    const vector<pg_log_entry_t> &log_entries,
     boost::optional<pg_hit_set_history_t> &hset_history,
     InProgressOp *op,
     ObjectStore::Transaction *op_t,
@@ -380,7 +380,7 @@ private:
     eversion_t pg_trim_rollback_to,
     hobject_t new_temp_oid,
     hobject_t discard_temp_oid,
-    vector<pg_log_entry_t> &log_entries,
+    const vector<pg_log_entry_t> &log_entries,
     boost::optional<pg_hit_set_history_t> &hset_history,
     InProgressOp *op,
     ObjectStore::Transaction *op_t);
index 5ebf34dc29d542fa193930a29394fd39e13a8a39..b0a9ffbc066add5104f3e66ab2341fbd4d72d76a 100644 (file)
@@ -7532,7 +7532,7 @@ Message * ReplicatedBackend::generate_subop(
   eversion_t pg_trim_rollback_to,
   hobject_t new_temp_oid,
   hobject_t discard_temp_oid,
-  vector<pg_log_entry_t> &log_entries,
+  const vector<pg_log_entry_t> &log_entries,
   boost::optional<pg_hit_set_history_t> &hset_hist,
   InProgressOp *op,
   ObjectStore::Transaction *op_t,
@@ -7587,7 +7587,7 @@ void ReplicatedBackend::issue_op(
   eversion_t pg_trim_rollback_to,
   hobject_t new_temp_oid,
   hobject_t discard_temp_oid,
-  vector<pg_log_entry_t> &log_entries,
+  const vector<pg_log_entry_t> &log_entries,
   boost::optional<pg_hit_set_history_t> &hset_hist,
   InProgressOp *op,
   ObjectStore::Transaction *op_t)
index 0b0adf5e53cd9b7b69f5b03b674de9993f3b375f..a32e80d6bb307f54f375c407f91edb310e2f56bf 100644 (file)
@@ -374,7 +374,7 @@ public:
     return get_object_context(hoid, true, &attrs);
   }
   void log_operation(
-    vector<pg_log_entry_t> &logv,
+    const vector<pg_log_entry_t> &logv,
     boost::optional<pg_hit_set_history_t> &hset_history,
     const eversion_t &trim_to,
     const eversion_t &trim_rollback_to,