Skip to content

Commit

Permalink
osd/osd_type: kill log.approx_size()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
xiexingguo committed Oct 24, 2017
1 parent 94c7e97 commit 46bfe36
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
2 changes: 1 addition & 1 deletion src/osd/PrimaryLogPG.cc
Expand Up @@ -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;
Expand Down
4 changes: 0 additions & 4 deletions src/osd/osd_types.h
Expand Up @@ -3593,10 +3593,6 @@ struct pg_log_t {
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);
Expand Down

0 comments on commit 46bfe36

Please sign in to comment.