diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 877281570abf3..85c47c13da64b 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -10161,7 +10161,7 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op, err = -ENOTEMPTY; goto reply; } - if (tp->ec_pool()) { + if (tp->is_erasure()) { ss << "tier pool '" << tierpoolstr << "' is an ec pool, which cannot be a tier"; err = -ENOTSUP; diff --git a/src/osd/OSDMap.h b/src/osd/OSDMap.h index 0fbbaf236b1b6..5b0b8afca0856 100644 --- a/src/osd/OSDMap.h +++ b/src/osd/OSDMap.h @@ -1129,14 +1129,14 @@ class OSDMap { bool pg_is_ec(pg_t pg) const { auto i = pools.find(pg.pool()); assert(i != pools.end()); - return i->second.ec_pool(); + return i->second.is_erasure(); } bool get_primary_shard(const pg_t& pgid, spg_t *out) const { auto i = get_pools().find(pgid.pool()); if (i == get_pools().end()) { return false; } - if (!i->second.ec_pool()) { + if (!i->second.is_erasure()) { *out = spg_t(pgid); return true; } diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 432d536b62122..5256d8d9561b4 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -924,7 +924,7 @@ PastIntervals::PriorSet PG::build_prior() const OSDMap &osdmap = *get_osdmap(); PastIntervals::PriorSet prior = past_intervals.get_prior_set( - pool.info.ec_pool(), + pool.info.is_erasure(), info.history.last_epoch_started, get_pgbackend()->get_is_recoverable_predicate(), [&](epoch_t start, int osd, epoch_t *lost_at) { @@ -1388,7 +1388,7 @@ bool PG::choose_acting(pg_shard_t &auth_log_shard_id, vector want; pg_shard_t want_primary; stringstream ss; - if (!pool.info.ec_pool()) + if (!pool.info.is_erasure()) calc_replicated_acting( auth_log_shard, get_osdmap()->get_pg_size(info.pgid.pgid), @@ -1425,7 +1425,7 @@ bool PG::choose_acting(pg_shard_t &auth_log_shard_id, have.insert( pg_shard_t( want[i], - pool.info.ec_pool() ? shard_id_t(i) : shard_id_t::NO_SHARD)); + pool.info.is_erasure() ? shard_id_t(i) : shard_id_t::NO_SHARD)); } } @@ -1433,7 +1433,7 @@ bool PG::choose_acting(pg_shard_t &auth_log_shard_id, // does not currently maintain rollbackability // Otherwise, we will go "peered", but not "active" if (num_want_acting < pool.info.min_size && - (pool.info.ec_pool() || + (pool.info.is_erasure() || !cct->_conf->osd_allow_recovery_below_min_size)) { want_acting.clear(); dout(10) << "choose_acting failed, below min size" << dendl; @@ -1503,7 +1503,7 @@ void PG::build_might_have_unfound() might_have_unfound = past_intervals.get_might_have_unfound( pg_whoami, - pool.info.ec_pool()); + pool.info.is_erasure()); // include any (stray) peers for (map::iterator p = peer_info.begin(); diff --git a/src/osd/PG.h b/src/osd/PG.h index d9eb6a3fd074c..172f7fdd6412a 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -339,7 +339,7 @@ class PG : public DoutPrefixProvider { public: bool is_ec_pg() const { - return pool.info.ec_pool(); + return pool.info.is_erasure(); } // pg state pg_info_t info; ///< current pg info @@ -957,10 +957,10 @@ class PG : public DoutPrefixProvider { return actingbackfill.count(osd); } bool is_acting(pg_shard_t osd) const { - return has_shard(pool.info.ec_pool(), acting, osd); + return has_shard(pool.info.is_erasure(), acting, osd); } bool is_up(pg_shard_t osd) const { - return has_shard(pool.info.ec_pool(), up, osd); + return has_shard(pool.info.is_erasure(), up, osd); } static bool has_shard(bool ec, const vector& v, pg_shard_t osd) { if (ec) { @@ -2265,7 +2265,7 @@ class PG : public DoutPrefixProvider { actingset.insert( pg_shard_t( acting[i], - pool.info.ec_pool() ? shard_id_t(i) : shard_id_t::NO_SHARD)); + pool.info.is_erasure() ? shard_id_t(i) : shard_id_t::NO_SHARD)); } upset.clear(); up = newup; @@ -2274,9 +2274,9 @@ class PG : public DoutPrefixProvider { upset.insert( pg_shard_t( up[i], - pool.info.ec_pool() ? shard_id_t(i) : shard_id_t::NO_SHARD)); + pool.info.is_erasure() ? shard_id_t(i) : shard_id_t::NO_SHARD)); } - if (!pool.info.ec_pool()) { + if (!pool.info.is_erasure()) { up_primary = pg_shard_t(new_up_primary, shard_id_t::NO_SHARD); primary = pg_shard_t(new_acting_primary, shard_id_t::NO_SHARD); return; diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index d89eef9bad763..4057f7e427ac3 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -980,7 +980,7 @@ int PrimaryLogPG::do_command( cmd_getval(cct, cmdmap, "mulcmd", mulcmd); int mode = -1; if (mulcmd == "revert") { - if (pool.info.ec_pool()) { + if (pool.info.is_erasure()) { ss << "mode must be 'delete' for ec pool"; return -EINVAL; } @@ -4751,7 +4751,7 @@ int PrimaryLogPG::do_sparse_read(OpContext *ctx, OSDOp& osd_op) { } ++ctx->num_read; - if (pool.info.ec_pool()) { + if (pool.info.is_erasure()) { // translate sparse read to a normal one if not supported uint64_t offset = op.extent.offset; uint64_t length = op.extent.length; @@ -10250,7 +10250,7 @@ void PrimaryLogPG::do_update_log_missing(OpRequestRef &op) * * This behavior is no longer necessary, but we preserve it so old * primaries can keep their repops in order */ - if (pool.info.ec_pool()) { + if (pool.info.is_erasure()) { t.register_on_complete(complete); } else { t.register_on_commit(complete); diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index 8899cf71bfae7..ef4f72255483d 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -1235,7 +1235,7 @@ void pg_pool_t::convert_to_pg_shards(const vector &from, set* t to->insert( pg_shard_t( from[i], - ec_pool() ? shard_id_t(i) : shard_id_t::NO_SHARD)); + is_erasure() ? shard_id_t(i) : shard_id_t::NO_SHARD)); } } } @@ -3446,7 +3446,7 @@ bool PastIntervals::check_new_interval( if (out) *out << __func__ << " " << i << " : acting set is too small" << std::endl; } - past_intervals->past_intervals->add_interval(old_pg_pool.ec_pool(), i); + past_intervals->past_intervals->add_interval(old_pg_pool.is_erasure(), i); return true; } else { return false; diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index e1429921dedb0..ed2b31da2d9b3 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -1449,11 +1449,8 @@ struct pg_pool_t { void set_flag(uint64_t f) { flags |= f; } void unset_flag(uint64_t f) { flags &= ~f; } - bool ec_pool() const { - return type == TYPE_ERASURE; - } bool require_rollback() const { - return ec_pool(); + return is_erasure(); } /// true if incomplete clones may be present