From: Samuel Just Date: Wed, 3 Apr 2019 23:57:47 +0000 (-0700) Subject: osd/: clean up PeeringState::write_if_dirty X-Git-Tag: v15.1.0~2774^2~30 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d99fd0508eb3552bdc6800e3014dcebdd7a1199e;p=ceph.git osd/: clean up PeeringState::write_if_dirty Signed-off-by: Samuel Just --- diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 039ec2199f9f..1c5b02ec3326 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 *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 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 *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 2ba1b3f4e087..0448cf0a8788 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 *km); - static int _prepare_write_info( CephContext* cct, map *km, diff --git a/src/osd/PeeringState.cc b/src/osd/PeeringState.cc index 6561d5298e2f..fc92ba4ffb18 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 d6123bfda393..050f6df0fbfa 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,