diff options
author | Loic Dachary <loic@dachary.org> | 2013-06-02 12:50:13 +0200 |
---|---|---|
committer | Loic Dachary <loic@dachary.org> | 2013-06-02 12:50:13 +0200 |
commit | 6cdc4f8fda11dd397f4b05acdcf66e7522e5a681 (patch) | |
tree | e6961e493d76c2ab23f2bfadb3554a4b590a43b5 | |
parent | fbf5a242d91e293e4e24fbb94e31e163374c7912 (diff) | |
download | ceph-6cdc4f8fda11dd397f4b05acdcf66e7522e5a681.tar.gz |
merge_old_entry arguments info and oe are changed to const because
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>
-rw-r--r-- | src/osd/PGLog.cc | 12 | ||||
-rw-r--r-- | src/osd/PGLog.h | 7 |
2 files changed, 15 insertions, 4 deletions
diff --git a/src/osd/PGLog.cc b/src/osd/PGLog.cc index 638a78697db..cc897e00ae8 100644 --- a/src/osd/PGLog.cc +++ b/src/osd/PGLog.cc @@ -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; diff --git a/src/osd/PGLog.h b/src/osd/PGLog.h index cfb17f16ce2..c1a5195828f 100644 --- a/src/osd/PGLog.h +++ b/src/osd/PGLog.h @@ -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, |