]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
PG: use !empty() instead of size() > 0
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Wed, 19 Feb 2014 17:17:54 +0000 (18:17 +0100)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Wed, 19 Feb 2014 17:17:54 +0000 (18:17 +0100)
[src/osd/PG.cc:543]: (performance) Possible inefficient checking
  for 'actingbackfill' emptiness.
[src/osd/PG.cc:1480]: (performance) Possible inefficient checking
  for 'actingbackfill' emptiness.
[src/osd/PG.cc:1774]: (performance) Possible inefficient checking
  for 'actingbackfill' emptiness.
[src/osd/PG.cc:1810]: (performance) Possible inefficient checking
  for 'actingbackfill' emptiness.
[src/osd/PG.cc:2229]: (performance) Possible inefficient checking
  for 'actingbackfill' emptiness.
[src/osd/PG.cc:2599]: (performance) Possible inefficient checking
  for 'actingbackfill' emptiness.
[src/osd/PG.cc:4345]: (performance) Possible inefficient checking
  for 'actingbackfill' emptiness.
[src/osd/PG.cc:6067]: (performance) Possible inefficient checking
  for 'actingbackfill' emptiness.
[src/osd/PG.cc:6264]: (performance) Possible inefficient checking
  for 'actingbackfill' emptiness.
[src/osd/PG.cc:6807]: (performance) Possible inefficient checking
  for 'actingbackfill' emptiness.
[src/osd/PG.cc:7014]: (performance) Possible inefficient checking
  for 'actingbackfill' emptiness.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
src/osd/PG.cc

index bfb48feb880e80f4da47ce73359c1b1a105b42cc..0e65d4c6b4b24366713e0349dd8ff7b26b0d5094 100644 (file)
@@ -540,7 +540,7 @@ bool PG::needs_recovery() const
     ret = true;
   }
 
-  assert(actingbackfill.size() > 0);
+  assert(!actingbackfill.empty());
   set<pg_shard_t>::const_iterator end = actingbackfill.end();
   set<pg_shard_t>::const_iterator a = actingbackfill.begin();
   assert(a != end);
@@ -1477,7 +1477,7 @@ void PG::activate(ObjectStore::Transaction& t,
     assert(ctx);
     // start up replicas
 
-    assert(actingbackfill.size() > 0);
+    assert(!actingbackfill.empty());
     for (set<pg_shard_t>::iterator i = actingbackfill.begin();
         i != actingbackfill.end();
         ++i) {
@@ -1771,7 +1771,7 @@ void PG::_activate_committed(epoch_t e)
     dout(10) << "_activate_committed " << e << " peer_activated now " << peer_activated 
             << " last_epoch_started " << info.history.last_epoch_started
             << " same_interval_since " << info.history.same_interval_since << dendl;
-    assert(actingbackfill.size() > 0);
+    assert(!actingbackfill.empty());
     if (peer_activated.size() == actingbackfill.size())
       all_activated_and_committed();
   } else {
@@ -1807,7 +1807,7 @@ void PG::all_activated_and_committed()
   dout(10) << "all_activated_and_committed" << dendl;
   assert(is_primary());
   assert(peer_activated.size() == actingbackfill.size());
-  assert(actingbackfill.size() > 0);
+  assert(!actingbackfill.empty());
 
   // info.last_epoch_started is set during activate()
   info.history.last_epoch_started = info.last_epoch_started;
@@ -2226,7 +2226,7 @@ void PG::_update_calc_stats()
       pg_log.get_missing().num_missing();
     degraded += pg_log.get_missing().num_missing();
 
-    assert(actingbackfill.size() > 0);
+    assert(!actingbackfill.empty());
     for (set<pg_shard_t>::iterator i = actingbackfill.begin();
         i != actingbackfill.end();
         ++i) {
@@ -2596,7 +2596,7 @@ void PG::trim_peers()
   calc_trim_to();
   dout(10) << "trim_peers " << pg_trim_to << dendl;
   if (pg_trim_to != eversion_t()) {
-    assert(actingbackfill.size() > 0);
+    assert(!actingbackfill.empty());
     for (set<pg_shard_t>::iterator i = actingbackfill.begin();
         i != actingbackfill.end();
         ++i) {
@@ -4342,7 +4342,7 @@ void PG::share_pg_info()
   dout(10) << "share_pg_info" << dendl;
 
   // share new pg_info_t with replicas
-  assert(actingbackfill.size() > 0);
+  assert(!actingbackfill.empty());
   for (set<pg_shard_t>::iterator i = actingbackfill.begin();
        i != actingbackfill.end();
        ++i) {
@@ -6064,7 +6064,7 @@ PG::RecoveryState::Recovered::Recovered(my_context ctx)
 
   // if we finished backfill, all acting are active; recheck if
   // DEGRADED is appropriate.
-  assert(pg->actingbackfill.size() > 0);
+  assert(!pg->actingbackfill.empty());
   if (pg->get_osdmap()->get_pg_size(pg->info.pgid.pgid) <=
       pg->actingbackfill.size())
     pg->state_clear(PG_STATE_DEGRADED);
@@ -6261,7 +6261,7 @@ boost::statechart::result PG::RecoveryState::Active::react(const MInfoRec& infoe
   assert(pg->is_active());
   assert(pg->is_primary());
 
-  assert(pg->actingbackfill.size() > 0);
+  assert(!pg->actingbackfill.empty());
   // don't update history (yet) if we are active and primary; the replica
   // may be telling us they have activated (and committed) but we can't
   // share that until _everyone_ does the same.
@@ -6804,7 +6804,7 @@ PG::RecoveryState::GetLog::GetLog(my_context ctx)
 
   // how much log to request?
   eversion_t request_log_from = pg->info.last_update;
-  assert(pg->actingbackfill.size() > 0);
+  assert(!pg->actingbackfill.empty());
   for (set<pg_shard_t>::iterator p = pg->actingbackfill.begin();
        p != pg->actingbackfill.end();
        ++p) {
@@ -7011,7 +7011,7 @@ PG::RecoveryState::GetMissing::GetMissing(my_context ctx)
   context< RecoveryMachine >().log_enter(state_name);
 
   PG *pg = context< RecoveryMachine >().pg;
-  assert(pg->actingbackfill.size() > 0);
+  assert(!pg->actingbackfill.empty());
   for (set<pg_shard_t>::iterator i = pg->actingbackfill.begin();
        i != pg->actingbackfill.end();
        ++i) {