]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/osd_type: kill log.approx_size() 18481/head
authorxie xingguo <xie.xingguo@zte.com.cn>
Sat, 21 Oct 2017 02:21:56 +0000 (10:21 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Tue, 24 Oct 2017 00:37:17 +0000 (08:37 +0800)
We used approx_size() because std::list::size() used to be O(n) instead of O(1),
but it is constant now in C++11.

Also counting the precise number of current log entries here is much more
meaningful.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/osd/PrimaryLogPG.cc
src/osd/osd_types.h

index 731f135fbb787d62c1c14756e43cc38a211b0f67..544af1d24e34ae98ddfd0e32a5be79e5d72cae60 100644 (file)
@@ -711,7 +711,7 @@ void PrimaryLogPG::maybe_force_recovery()
                  PG_STATE_BACKFILL_TOOFULL))
     return;
 
-  if (pg_log.get_log().approx_size() <
+  if (pg_log.get_log().log.size() <
       cct->_conf->osd_max_pg_log_entries *
         cct->_conf->osd_force_recovery_pg_log_entries_factor)
     return;
index 392adfaf8b22a75b55c97ff0a6816e6515eac53f..38b4d24dd4a965eb9befd0471b0e326cee92cf84 100644 (file)
@@ -3593,10 +3593,6 @@ public:
     return head.version == 0 && head.epoch == 0;
   }
 
-  size_t approx_size() const {
-    return head.version - tail.version;
-  }
-
   static void filter_log(spg_t import_pgid, const OSDMap &curmap,
     const string &hit_set_namespace, const pg_log_t &in,
     pg_log_t &out, pg_log_t &reject);