]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/: clean up PeeringState::write_if_dirty
authorSamuel Just <sjust@redhat.com>
Wed, 3 Apr 2019 23:57:47 +0000 (16:57 -0700)
committersjust@redhat.com <sjust@redhat.com>
Wed, 1 May 2019 18:22:24 +0000 (11:22 -0700)
Signed-off-by: Samuel Just <sjust@redhat.com>
src/osd/PG.cc
src/osd/PG.h
src/osd/PeeringState.cc
src/osd/PeeringState.h

index 039ec2199f9f1d9e331fc8620e27594e8988014b..1c5b02ec332624d9f5ae683d65d4b751e9e6fd64 100644 (file)
@@ -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"
index 2ba1b3f4e0873f1b1b2126c08ab3dd4b85ff610b..0448cf0a8788833fa7191c2d9402d2991cb01311 100644 (file)
@@ -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,
index 6561d5298e2f46cb1a1f73256021a930be453535..fc92ba4ffb189fc858b8c9138283f54e3c005dc6 100644 (file)
@@ -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(
index d6123bfda393894e24f18bd3d020ccca76115d68..050f6df0fbfa2355c4731223e59885f20bd5d442 100644 (file)
@@ -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,