]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: add the support of per pool scrub priority
authorZhiqiang Wang <zhiqiang@xsky.com>
Thu, 25 Feb 2016 11:06:12 +0000 (06:06 -0500)
committerZhiqiang Wang <zhiqiang@xsky.com>
Thu, 25 Feb 2016 11:06:12 +0000 (06:06 -0500)
ceph osd pool get pool_name scrub_priority
ceph osd pool set pool_name scrub_priority x

Signed-off-by: Zhiqiang Wang <zhiqiang@xsky.com>
src/mon/MonCommands.h
src/mon/OSDMonitor.cc
src/osd/OSD.h
src/osd/PG.cc
src/osd/PG.h
src/osd/osd_types.cc
src/osd/osd_types.h

index 0a1122d98a5891bf2d343ae277fd553effaf8fd0..c68058de79b02a47a9615e28fe68bab10e813afe 100644 (file)
@@ -676,11 +676,11 @@ COMMAND("osd pool rename " \
        "rename <srcpool> to <destpool>", "osd", "rw", "cli,rest")
 COMMAND("osd pool get " \
        "name=pool,type=CephPoolname " \
-       "name=var,type=CephChoices,strings=size|min_size|crash_replay_interval|pg_num|pgp_num|crush_ruleset|hashpspool|nodelete|nopgchange|nosizechange|write_fadvise_dontneed|noscrub|nodeep-scrub|hit_set_type|hit_set_period|hit_set_count|hit_set_fpp|auid|target_max_objects|target_max_bytes|cache_target_dirty_ratio|cache_target_dirty_high_ratio|cache_target_full_ratio|cache_min_flush_age|cache_min_evict_age|erasure_code_profile|min_read_recency_for_promote|all|min_write_recency_for_promote|fast_read|hit_set_grade_decay_rate|hit_set_search_last_n|scrub_min_interval|scrub_max_interval|deep_scrub_interval|recovery_priority|recovery_op_priority", \
+       "name=var,type=CephChoices,strings=size|min_size|crash_replay_interval|pg_num|pgp_num|crush_ruleset|hashpspool|nodelete|nopgchange|nosizechange|write_fadvise_dontneed|noscrub|nodeep-scrub|hit_set_type|hit_set_period|hit_set_count|hit_set_fpp|auid|target_max_objects|target_max_bytes|cache_target_dirty_ratio|cache_target_dirty_high_ratio|cache_target_full_ratio|cache_min_flush_age|cache_min_evict_age|erasure_code_profile|min_read_recency_for_promote|all|min_write_recency_for_promote|fast_read|hit_set_grade_decay_rate|hit_set_search_last_n|scrub_min_interval|scrub_max_interval|deep_scrub_interval|recovery_priority|recovery_op_priority|scrub_priority", \
        "get pool parameter <var>", "osd", "r", "cli,rest")
 COMMAND("osd pool set " \
        "name=pool,type=CephPoolname " \
-       "name=var,type=CephChoices,strings=size|min_size|crash_replay_interval|pg_num|pgp_num|crush_ruleset|hashpspool|nodelete|nopgchange|nosizechange|write_fadvise_dontneed|noscrub|nodeep-scrub|hit_set_type|hit_set_period|hit_set_count|hit_set_fpp|use_gmt_hitset|debug_fake_ec_pool|target_max_bytes|target_max_objects|cache_target_dirty_ratio|cache_target_dirty_high_ratio|cache_target_full_ratio|cache_min_flush_age|cache_min_evict_age|auid|min_read_recency_for_promote|min_write_recency_for_promote|fast_read|hit_set_grade_decay_rate|hit_set_search_last_n|scrub_min_interval|scrub_max_interval|deep_scrub_interval|recovery_priority|recovery_op_priority " \
+       "name=var,type=CephChoices,strings=size|min_size|crash_replay_interval|pg_num|pgp_num|crush_ruleset|hashpspool|nodelete|nopgchange|nosizechange|write_fadvise_dontneed|noscrub|nodeep-scrub|hit_set_type|hit_set_period|hit_set_count|hit_set_fpp|use_gmt_hitset|debug_fake_ec_pool|target_max_bytes|target_max_objects|cache_target_dirty_ratio|cache_target_dirty_high_ratio|cache_target_full_ratio|cache_min_flush_age|cache_min_evict_age|auid|min_read_recency_for_promote|min_write_recency_for_promote|fast_read|hit_set_grade_decay_rate|hit_set_search_last_n|scrub_min_interval|scrub_max_interval|deep_scrub_interval|recovery_priority|recovery_op_priority|scrub_priority " \
        "name=val,type=CephString " \
        "name=force,type=CephChoices,strings=--yes-i-really-mean-it,req=false", \
        "set pool parameter <var> to <val>", "osd", "rw", "cli,rest")
index f4c4b623327d3ed4dfeb945e03e2e250562b978d..4c3fde974e824b101f52d20d36cdf167a32aa0d5 100644 (file)
@@ -2923,7 +2923,7 @@ namespace {
     MIN_WRITE_RECENCY_FOR_PROMOTE, FAST_READ,
     HIT_SET_GRADE_DECAY_RATE, HIT_SET_SEARCH_LAST_N,
     SCRUB_MIN_INTERVAL, SCRUB_MAX_INTERVAL, DEEP_SCRUB_INTERVAL,
-    RECOVERY_PRIORITY, RECOVERY_OP_PRIORITY};
+    RECOVERY_PRIORITY, RECOVERY_OP_PRIORITY, SCRUB_PRIORITY};
 
   std::set<osd_pool_get_choices>
     subtract_second_from_first(const std::set<osd_pool_get_choices>& first,
@@ -3404,7 +3404,8 @@ bool OSDMonitor::preprocess_command(MonOpRequestRef op)
       ("scrub_max_interval", SCRUB_MAX_INTERVAL)
       ("deep_scrub_interval", DEEP_SCRUB_INTERVAL)
       ("recovery_priority", RECOVERY_PRIORITY)
-      ("recovery_op_priority", RECOVERY_OP_PRIORITY);
+      ("recovery_op_priority", RECOVERY_OP_PRIORITY)
+      ("scrub_priority", SCRUB_PRIORITY);
 
     typedef std::set<osd_pool_get_choices> choices_set_t;
 
@@ -3588,6 +3589,7 @@ bool OSDMonitor::preprocess_command(MonOpRequestRef op)
          case DEEP_SCRUB_INTERVAL:
           case RECOVERY_PRIORITY:
           case RECOVERY_OP_PRIORITY:
+          case SCRUB_PRIORITY:
            for (i = ALL_CHOICES.begin(); i != ALL_CHOICES.end(); ++i) {
              if (i->second == *it)
                break;
@@ -3721,6 +3723,7 @@ bool OSDMonitor::preprocess_command(MonOpRequestRef op)
          case DEEP_SCRUB_INTERVAL:
           case RECOVERY_PRIORITY:
           case RECOVERY_OP_PRIORITY:
+          case SCRUB_PRIORITY:
            for (i = ALL_CHOICES.begin(); i != ALL_CHOICES.end(); ++i) {
              if (i->second == *it)
                break;
index dd8b9379d1b874fa679ea601885ae44983fc7cba..59ae3ef3a255116157a66947e5cdcd39717ecf3b 100644 (file)
@@ -845,7 +845,7 @@ public:
        PGQueueable(
          PGScrub(pg->get_osdmap()->get_epoch()),
          cct->_conf->osd_scrub_cost,
-         cct->_conf->osd_scrub_priority,
+         pg->get_scrub_priority(),
          ceph_clock_now(cct),
          entity_inst_t())));
   }
index f3f7b1295d450133df2e734e6c6a0235a16f9319..799d8d4c15ee4658d5e51496ba0e300410a27f5c 100644 (file)
@@ -2047,6 +2047,14 @@ bool PG::queue_scrub()
   return true;
 }
 
+unsigned PG::get_scrub_priority()
+{
+  // a higher value -> a higher priority
+  int pool_scrub_priority = 0;
+  pool.info.opts.get(pool_opts_t::SCRUB_PRIORITY, &pool_scrub_priority);
+  return pool_scrub_priority > 0 ? pool_scrub_priority : cct->_conf->osd_scrub_priority;
+}
+
 struct C_PG_FinishRecovery : public Context {
   PGRef pg;
   C_PG_FinishRecovery(PG *p) : pg(p) {}
index 5ab8d59d57f30e7d7a71c6f9137d46ae6c83d57b..5cb811eb3486c392d2d6c02102a0a41c636a7c56 100644 (file)
@@ -2216,6 +2216,7 @@ public:
   void queue_snap_trim();
   bool requeue_scrub();
   bool queue_scrub();
+  unsigned get_scrub_priority();
 
   /// share pg info after a pg is active
   void share_pg_info();
index ca59a7912e8b2723d617a40cc79d2d3b24c5ba92..0fc821a161f09ad50e5d6b0645f062fda634de8b 100644 (file)
@@ -928,7 +928,9 @@ static opt_mapping_t opt_mapping = boost::assign::map_list_of
            ("recovery_priority", pool_opts_t::opt_desc_t(
              pool_opts_t::RECOVERY_PRIORITY, pool_opts_t::INT))
            ("recovery_op_priority", pool_opts_t::opt_desc_t(
-             pool_opts_t::RECOVERY_OP_PRIORITY, pool_opts_t::INT));
+             pool_opts_t::RECOVERY_OP_PRIORITY, pool_opts_t::INT))
+           ("scrub_priority", pool_opts_t::opt_desc_t(
+             pool_opts_t::SCRUB_PRIORITY, pool_opts_t::INT));
 
 bool pool_opts_t::is_opt_name(const std::string& name) {
     return opt_mapping.find(name) != opt_mapping.end();
index a400338904a402e1f01245246c55c56638eeee75..09adf9dbb32ef99029eb5f9ec80fd1084367fb27 100644 (file)
@@ -926,7 +926,8 @@ public:
     SCRUB_MAX_INTERVAL,
     DEEP_SCRUB_INTERVAL,
     RECOVERY_PRIORITY,
-    RECOVERY_OP_PRIORITY
+    RECOVERY_OP_PRIORITY,
+    SCRUB_PRIORITY
   };
 
   enum type_t {