From e11cc1c8c3412127f4ce686c0146c2c3dcc2aea3 Mon Sep 17 00:00:00 2001 From: Loic Dachary Date: Mon, 10 Jun 2013 18:39:47 +0200 Subject: [PATCH] add constness to PGLog::proc_replica_log 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 --- src/osd/PGLog.cc | 4 ++-- src/osd/PGLog.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/osd/PGLog.cc b/src/osd/PGLog.cc index d62991e06d67a..94639eedaff00 100644 --- a/src/osd/PGLog.cc +++ b/src/osd/PGLog.cc @@ -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; diff --git a/src/osd/PGLog.h b/src/osd/PGLog.h index bc40e23709b51..d6e566a8eebb7 100644 --- a/src/osd/PGLog.h +++ b/src/osd/PGLog.h @@ -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, -- 2.39.5