diff options
-rw-r--r-- | src/osd/PG.cc | 40 | ||||
-rw-r--r-- | src/osd/PG.h | 8 | ||||
-rw-r--r-- | src/osd/PeeringState.cc | 9 | ||||
-rw-r--r-- | src/osd/PeeringState.h | 2 |
4 files changed, 28 insertions, 31 deletions
diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 039ec2199f9..1c5b02ec332 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -968,7 +968,8 @@ void PG::upgrade(ObjectStore *store) int PG::_prepare_write_info(CephContext* cct, map<string,bufferlist> *km, epoch_t epoch, - pg_info_t &info, pg_info_t &last_written_info, + pg_info_t &info, + pg_info_t &last_written_info, PastIntervals &past_intervals, bool dirty_big_info, bool dirty_epoch, @@ -1009,6 +1010,7 @@ int PG::_prepare_write_info(CephContext* cct, } *_dout << dendl; } + last_written_info = info; // info. store purged_snaps separately. @@ -1061,6 +1063,8 @@ void PG::_init(ObjectStore::Transaction& t, spg_t pgid, const pg_pool_t *pool) void PG::prepare_write( pg_info_t &info, + pg_info_t &last_written_info, + PastIntervals &past_intervals, PGLog &pglog, bool dirty_info, bool dirty_big_info, @@ -1071,37 +1075,25 @@ void PG::prepare_write( unstable_stats.clear(); map<string,bufferlist> km; if (dirty_big_info || dirty_info) { - prepare_write_info( - dirty_info, + int ret = _prepare_write_info( + cct, + &km, + get_osdmap_epoch(), + info, + last_written_info, + past_intervals, dirty_big_info, need_write_epoch, - &km); + cct->_conf->osd_fast_info, + osd->logger); + ceph_assert(ret == 0); } - pg_log.write_log_and_missing( + pglog.write_log_and_missing( t, &km, coll, pgmeta_oid, pool.info.require_rollback()); if (!km.empty()) t.omap_setkeys(coll, pgmeta_oid, km); } -void PG::prepare_write_info( - bool dirty_info, - bool dirty_big_info, - bool need_update_epoch, - map<string,bufferlist> *km) -{ - int ret = _prepare_write_info(cct, km, get_osdmap_epoch(), - info, - last_written_info, - past_intervals, - dirty_big_info, need_update_epoch, - cct->_conf->osd_fast_info, - osd->logger); - ceph_assert(ret == 0); - - dirty_info = false; - dirty_big_info = false; -} - #pragma GCC diagnostic ignored "-Wpragmas" #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" diff --git a/src/osd/PG.h b/src/osd/PG.h index 2ba1b3f4e08..0448cf0a878 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -1437,18 +1437,14 @@ public: virtual void prepare_write( pg_info_t &info, + pg_info_t &last_written_info, + PastIntervals &past_intervals, PGLog &pglog, bool dirty_info, bool dirty_big_info, bool need_write_epoch, ObjectStore::Transaction &t) override; - void prepare_write_info( - bool dirty_info, - bool dirty_big_info, - bool need_update_epoch, - map<string,bufferlist> *km); - static int _prepare_write_info( CephContext* cct, map<string,bufferlist> *km, diff --git a/src/osd/PeeringState.cc b/src/osd/PeeringState.cc index 6561d5298e2..fc92ba4ffb1 100644 --- a/src/osd/PeeringState.cc +++ b/src/osd/PeeringState.cc @@ -365,12 +365,19 @@ void PeeringState::write_if_dirty(ObjectStore::Transaction& t) { pl->prepare_write( info, + last_written_info, + past_intervals, pg_log, dirty_info, dirty_big_info, last_persisted_osdmap < get_osdmap_epoch(), t); - last_persisted_osdmap = get_osdmap_epoch(); + if (dirty_info || dirty_big_info) { + last_persisted_osdmap = get_osdmap_epoch(); + last_written_info = info; + dirty_info = false; + dirty_big_info = false; + } } void PeeringState::advance_map( diff --git a/src/osd/PeeringState.h b/src/osd/PeeringState.h index d6123bfda39..050f6df0fbf 100644 --- a/src/osd/PeeringState.h +++ b/src/osd/PeeringState.h @@ -57,6 +57,8 @@ public: struct PeeringListener : public EpochSource { virtual void prepare_write( pg_info_t &info, + pg_info_t &last_written_info, + PastIntervals &past_intervals, PGLog &pglog, bool dirty_info, bool dirty_big_info, |