]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd_types: rename swap to claim, restrict to the non-tracking variant
authorSamuel Just <sjust@redhat.com>
Wed, 20 Jul 2016 02:11:02 +0000 (19:11 -0700)
committerSamuel Just <sjust@redhat.com>
Fri, 22 Jul 2016 21:30:58 +0000 (14:30 -0700)
Signed-off-by: Samuel Just <sjust@redhat.com>
src/osd/PG.cc
src/osd/osd_types.h
src/test/osd/types.cc

index 66cf81a3a0c41bba3b7f97d4d39e6cd245bd340c..f14db8d7078ca9fa4963b0960e4f4992d5d7fc7c 100644 (file)
@@ -320,7 +320,7 @@ void PG::proc_master_log(
   assert(cct->_conf->osd_find_best_info_ignore_history_les ||
         info.last_epoch_started >= info.history.last_epoch_started);
 
-  peer_missing[from].swap(omissing);
+  peer_missing[from].claim(omissing);
 }
     
 void PG::proc_replica_log(
@@ -344,7 +344,7 @@ void PG::proc_replica_log(
     dout(20) << " after missing " << i->first << " need " << i->second.need
             << " have " << i->second.have << dendl;
   }
-  peer_missing[from].swap(omissing);
+  peer_missing[from].claim(omissing);
 }
 
 bool PG::proc_replica_info(
@@ -7711,7 +7711,7 @@ boost::statechart::result PG::RecoveryState::WaitUpThru::react(const MLogRec& lo
 {
   dout(10) << "Noting missing from osd." << logevt.from << dendl;
   PG *pg = context< RecoveryMachine >().pg;
-  pg->peer_missing[logevt.from].swap(logevt.msg->missing);
+  pg->peer_missing[logevt.from].claim(logevt.msg->missing);
   pg->peer_info[logevt.from] = logevt.msg->info;
   return discard_event();
 }
index a2b8ba7d09b3a693f018fbb26c884660bc791da5..7d755f7b3863071824d617ad3238f1117b05cd49 100644 (file)
@@ -2884,13 +2884,10 @@ public:
     return item.have;
   }
 
-  void swap(pg_missing_set& o) {
-    for (auto &&i: missing)
-      tracker.changed(i.first);
+  void claim(pg_missing_set& o) {
+    static_assert(!TrackChanges, "Can't use claim with TrackChanges");
     missing.swap(o.missing);
     rmissing.swap(o.rmissing);
-    for (auto &&i: missing)
-      tracker.changed(i.first);
   }
 
   /*
index d4036a6db6965d77b3350b9cc38e739fca97c7bf..a2a853f2fdd5ce55ba30219914ebf62fb92db97a 100644 (file)
@@ -749,7 +749,7 @@ TEST(pg_missing_t, have_missing)
   EXPECT_TRUE(missing.have_missing());
 }
 
-TEST(pg_missing_t, swap)
+TEST(pg_missing_t, claim)
 {
   hobject_t oid(object_t("objname"), "key", 123, 456, 0, "");
   pg_missing_t missing;
@@ -760,8 +760,7 @@ TEST(pg_missing_t, swap)
   pg_missing_t other;
   EXPECT_FALSE(other.have_missing());
 
-  other.swap(missing);
-  EXPECT_FALSE(missing.have_missing());
+  other.claim(missing);
   EXPECT_TRUE(other.have_missing());
 }