]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
merge_old_entry arguments info and oe are changed to const because 339/head
authorLoic Dachary <loic@dachary.org>
Sun, 2 Jun 2013 10:50:13 +0000 (12:50 +0200)
committerLoic Dachary <loic@dachary.org>
Sun, 2 Jun 2013 10:50:13 +0000 (12:50 +0200)
there is no side effect.

The PGLog::clear function is added to reset all data members to the
same state they have after the object is constructed.

Signed-off-by: Loic Dachary <loic@dachary.org>
src/osd/PGLog.cc
src/osd/PGLog.h

index 638a78697db2d81513e92765647ed556f23b1602..cc897e00ae8d1575b50ec22bf5d8284d59ebd2fc 100644 (file)
@@ -21,7 +21,7 @@
 
 #define dout_subsys ceph_subsys_osd
 
-//////////////////// PGLog ////////////////////
+//////////////////// PGLog::IndexedLog ////////////////////
 
 void PGLog::IndexedLog::split_into(
   pg_t child_pgid,
@@ -103,6 +103,14 @@ ostream& PGLog::IndexedLog::print(ostream& out) const
 
 //////////////////// PGLog ////////////////////
 
+void PGLog::clear() {
+  ondisklog.zero();
+  ondisklog.has_checksums = true;
+  ondisklog.divergent_priors.clear();
+  missing.clear();
+  log.zero();
+}
+
 void PGLog::clear_info_log(
   pg_t pgid,
   const hobject_t &infos_oid,
@@ -251,7 +259,7 @@ void PGLog::proc_replica_log(ObjectStore::Transaction& t,
  *
  * return true if entry is not divergent.
  */
-bool PGLog::merge_old_entry(ObjectStore::Transaction& t, pg_log_entry_t& oe, pg_info_t& info, list<hobject_t>& remove_snap, bool &dirty_log)
+bool PGLog::merge_old_entry(ObjectStore::Transaction& t, const pg_log_entry_t& oe, const pg_info_t& info, list<hobject_t>& remove_snap, bool &dirty_log)
 {
   if (oe.soid > info.last_backfill) {
     dout(20) << "merge_old_entry  had " << oe << " : beyond last_backfill" << dendl;
index cfb17f16ce24b96d4873e105faed8f5df3a0db2a..c1a5195828feeb94308b90e622c7ebee92f1fed8 100644 (file)
@@ -235,6 +235,9 @@ protected:
   IndexedLog  log;
 
 public:
+
+  void clear();
+
   //////////////////// get or set missing ////////////////////
 
   const pg_missing_t& get_missing() const { return missing; }
@@ -352,8 +355,8 @@ public:
                        pg_missing_t& omissing, int from);
 
 protected:
-  bool merge_old_entry(ObjectStore::Transaction& t, pg_log_entry_t& oe,
-                      pg_info_t& info, list<hobject_t>& remove_snap, bool &dirty_log);
+  bool merge_old_entry(ObjectStore::Transaction& t, const pg_log_entry_t& oe,
+                      const pg_info_t& info, list<hobject_t>& remove_snap, bool &dirty_log);
 public:
   void rewind_divergent_log(ObjectStore::Transaction& t, eversion_t newhead,
                             pg_info_t &info, list<hobject_t>& remove_snap,