]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
add constness to PGLog::proc_replica_log
authorLoic Dachary <loic@dachary.org>
Mon, 10 Jun 2013 16:39:47 +0000 (18:39 +0200)
committerLoic Dachary <loic@dachary.org>
Wed, 19 Jun 2013 18:52:23 +0000 (20:52 +0200)
The function is made const by replacing a single call to log.objects[]
with log.objects.find. The olog argument is also a const and does not
require any change.

http://tracker.ceph.com/issues/5213 refs #5213

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

index d62991e06d67aa89fb2fe47dd2147132149a6ff3..94639eedaff00944e25db9d00de9d8d89cc35c80 100644 (file)
@@ -154,7 +154,7 @@ void PGLog::trim(eversion_t trim_to, pg_info_t &info)
 }
 
 void PGLog::proc_replica_log(ObjectStore::Transaction& t,
-                         pg_info_t &oinfo, pg_log_t &olog, pg_missing_t& omissing, int from)
+                         pg_info_t &oinfo, const pg_log_t &olog, pg_missing_t& omissing, int from) const
 {
   dout(10) << "proc_replica_log for osd." << from << ": "
           << oinfo << " " << olog << " " << omissing << dendl;
@@ -196,7 +196,7 @@ void PGLog::proc_replica_log(ObjectStore::Transaction& t,
       continue;
     }
       
-    pg_log_entry_t& ne = *log.objects[oe.soid];
+    const pg_log_entry_t& ne = *(log.objects.find(oe.soid)->second);
     if (ne.version == oe.version) {
       dout(10) << " had " << oe << " new " << ne << " : match, stopping" << dendl;
       lu = pp->version;
index bc40e23709b515ecf78d27488e241443d0914156..d6e566a8eebb78f2c76a33c6bc1c59ff805e534e 100644 (file)
@@ -336,8 +336,8 @@ public:
     log.last_requested = 0;
   }
 
-  void proc_replica_log(ObjectStore::Transaction& t, pg_info_t &oinfo, pg_log_t &olog,
-                       pg_missing_t& omissing, int from);
+  void proc_replica_log(ObjectStore::Transaction& t, pg_info_t &oinfo, const pg_log_t &olog,
+                       pg_missing_t& omissing, int from) const;
 
 protected:
   bool merge_old_entry(ObjectStore::Transaction& t, const pg_log_entry_t& oe,