]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: remove duplicated function ec_pool in pg_pool_t 18059/head
authorChang Liu <liuchang0812@gmail.com>
Sat, 30 Sep 2017 08:03:25 +0000 (16:03 +0800)
committerChang Liu <liuchang0812@gmail.com>
Sat, 30 Sep 2017 08:03:25 +0000 (16:03 +0800)
Signed-off-by: Chang Liu <liuchang0812@gmail.com>
src/mon/OSDMonitor.cc
src/osd/OSDMap.h
src/osd/PG.cc
src/osd/PG.h
src/osd/PrimaryLogPG.cc
src/osd/osd_types.cc
src/osd/osd_types.h

index 877281570abf354e314c95d3a1ca4e7bf235f78e..85c47c13da64b43d9390b387cd8bb7f399846d87 100644 (file)
@@ -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;
index 0fbbaf236b1b675d89cae365a4bbebd51030847d..5b0b8afca08564fac5340bce2b3ff74a5023a1e5 100644 (file)
@@ -1129,14 +1129,14 @@ public:
   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;
     }
index 432d536b6212245697ecf59e94964a11077d7728..5256d8d9561b49d8706362e9ce8604f263e42838 100644 (file)
@@ -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<int> 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<pg_shard_t, pg_info_t>::iterator p = peer_info.begin();
index d9eb6a3fd074cbbb4a309e528018faa16d5c8670..172f7fdd6412ac310e2758b8a41044d696eaa523 100644 (file)
@@ -339,7 +339,7 @@ public:
 
 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 @@ public:
     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<int>& v, pg_shard_t osd) {
     if (ec) {
@@ -2265,7 +2265,7 @@ public:
        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 @@ public:
        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;
index d89eef9bad763076d0e13ee9a23ef87f39ab6043..4057f7e427ac390caa8df5442eef89c2655e049b 100644 (file)
@@ -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);
index 8899cf71bfae70d8e1b0e5279805c6adb681e955..ef4f72255483d6398e465f53b32e06f2dd885af1 100644 (file)
@@ -1235,7 +1235,7 @@ void pg_pool_t::convert_to_pg_shards(const vector<int> &from, set<pg_shard_t>* 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;
index e1429921dedb09c6b277b79e4ef51210f18f53c8..ed2b31da2d9b326bcf82a821183418ec6e53a73a 100644 (file)
@@ -1449,11 +1449,8 @@ public:
   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