]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
PGLog: move the log size check after the early return
authorSamuel Just <sam.just@inktank.com>
Tue, 27 Aug 2013 06:19:45 +0000 (23:19 -0700)
committerSamuel Just <sam.just@inktank.com>
Fri, 6 Sep 2013 23:05:53 +0000 (16:05 -0700)
There really are stl implementations (like the one on my ubuntu 12.04
machine) which have a list::size() which is linear in the size of the
list.  That assert, therefore, is quite expensive!

Fixes: #6040
Backport: Dumpling
Signed-off-by: Samuel Just <sam.just@inktank.com>
(cherry picked from commit fe68b15a3d82349f8941f5b9f70fcbb5d4bc7f97)

src/osd/PGLog.h

index 552f9b0cee96b4246c0571239fe403cb0f41db22..712c1e1c9179754120f39656fad9f6062078e4d4 100644 (file)
@@ -205,11 +205,11 @@ protected:
         log_keys_debug->erase(i++));
   }
   void check() {
-    assert(log.log.size() == log_keys_debug.size());
     if (cct &&
         !(cct->_conf->osd_debug_pg_log_writeout)) {
       return;
     }
+    assert(log.log.size() == log_keys_debug.size());
     for (list<pg_log_entry_t>::iterator i = log.log.begin();
         i != log.log.end();
         ++i) {