diff --git a/src/mon/MonCommands.h b/src/mon/MonCommands.h index 0a1122d98a5..c68058de79b 100644 --- a/src/mon/MonCommands.h +++ b/src/mon/MonCommands.h @@ -676,11 +676,11 @@ COMMAND("osd pool rename " \ "rename to ", "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 ", "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 to ", "osd", "rw", "cli,rest") diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index f4c4b623327..4c3fde974e8 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -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 subtract_second_from_first(const std::set& 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 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; diff --git a/src/osd/OSD.h b/src/osd/OSD.h index dd8b9379d1b..59ae3ef3a25 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -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()))); } diff --git a/src/osd/PG.cc b/src/osd/PG.cc index f3f7b1295d4..799d8d4c15e 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -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) {} diff --git a/src/osd/PG.h b/src/osd/PG.h index 5ab8d59d57f..5cb811eb348 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -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(); diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index ca59a7912e8..0fc821a161f 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -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(); diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index a400338904a..09adf9dbb32 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -926,7 +926,8 @@ public: SCRUB_MAX_INTERVAL, DEEP_SCRUB_INTERVAL, RECOVERY_PRIORITY, - RECOVERY_OP_PRIORITY + RECOVERY_OP_PRIORITY, + SCRUB_PRIORITY }; enum type_t {