From: Samuel Just Date: Thu, 7 Aug 2025 15:47:19 +0000 (-0700) Subject: common/mclock_common: move profile defaults to header X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d4c89503b3351af5d1350978e4a726a9cfe91155;p=ceph.git common/mclock_common: move profile defaults to header Signed-off-by: Samuel Just --- diff --git a/src/common/mclock_common.cc b/src/common/mclock_common.cc index f560813939eb..d53e410192c4 100644 --- a/src/common/mclock_common.cc +++ b/src/common/mclock_common.cc @@ -187,64 +187,16 @@ void MclockConfig::set_config_defaults_from_profile() return; } - /** - * high_client_ops - * - * Client Allocation: - * reservation: 60% | weight: 2 | limit: 0 (max) | - * Background Recovery Allocation: - * reservation: 40% | weight: 1 | limit: 0 (max) | - * Background Best Effort Allocation: - * reservation: 0 (min) | weight: 1 | limit: 70% | - */ - static constexpr profile_t high_client_ops_profile{ - { .6, 2, 0 }, - { .4, 1, 0 }, - { 0, 1, .7 } - }; - - /** - * high_recovery_ops - * - * Client Allocation: - * reservation: 30% | weight: 1 | limit: 0 (max) | - * Background Recovery Allocation: - * reservation: 70% | weight: 2 | limit: 0 (max) | - * Background Best Effort Allocation: - * reservation: 0 (min) | weight: 1 | limit: 0 (max) | - */ - static constexpr profile_t high_recovery_ops_profile{ - { .3, 1, 0 }, - { .7, 2, 0 }, - { 0, 1, 0 } - }; - - /** - * balanced - * - * Client Allocation: - * reservation: 50% | weight: 1 | limit: 0 (max) | - * Background Recovery Allocation: - * reservation: 50% | weight: 1 | limit: 0 (max) | - * Background Best Effort Allocation: - * reservation: 0 (min) | weight: 1 | limit: 90% | - */ - static constexpr profile_t balanced_profile{ - { .5, 1, 0 }, - { .5, 1, 0 }, - { 0, 1, .9 } - }; - const profile_t *profile = nullptr; auto mclock_profile = cct->_conf.get_val("osd_mclock_profile"); if (mclock_profile == "high_client_ops") { - profile = &high_client_ops_profile; + profile = &HIGH_CLIENT_OPS; dout(10) << "Setting high_client_ops profile " << *profile << dendl; } else if (mclock_profile == "high_recovery_ops") { - profile = &high_recovery_ops_profile; + profile = &HIGH_RECOVERY_OPS; dout(10) << "Setting high_recovery_ops profile " << *profile << dendl; } else if (mclock_profile == "balanced") { - profile = &balanced_profile; + profile = &BALANCED; dout(10) << "Setting balanced profile " << *profile << dendl; } else if (mclock_profile == "custom") { dout(10) << "Profile set to custom, not setting defaults" << dendl; diff --git a/src/common/mclock_common.h b/src/common/mclock_common.h index 331f61bdfdd3..7a679f2c923f 100644 --- a/src/common/mclock_common.h +++ b/src/common/mclock_common.h @@ -80,6 +80,61 @@ struct profile_t { client_config_t client; client_config_t background_recovery; client_config_t background_best_effort; + + constexpr profile_t( + client_config_t client, + client_config_t background_recovery, + client_config_t background_best_effort + ) : client(client), background_recovery(background_recovery), + background_best_effort(background_best_effort) {} +}; + +/** + * high_client_ops + * + * Client Allocation: + * reservation: 60% | weight: 2 | limit: 0 (max) | + * Background Recovery Allocation: + * reservation: 40% | weight: 1 | limit: 0 (max) | + * Background Best Effort Allocation: + * reservation: 0 (min) | weight: 1 | limit: 70% | + */ +constexpr profile_t HIGH_CLIENT_OPS{ + { .6, 2, 0 }, + { .4, 1, 0 }, + { 0, 1, .7 } +}; + +/** + * high_recovery_ops + * + * Client Allocation: + * reservation: 30% | weight: 1 | limit: 0 (max) | + * Background Recovery Allocation: + * reservation: 70% | weight: 2 | limit: 0 (max) | + * Background Best Effort Allocation: + * reservation: 0 (min) | weight: 1 | limit: 0 (max) | + */ +constexpr profile_t HIGH_RECOVERY_OPS{ + { .3, 1, 0 }, + { .7, 2, 0 }, + { 0, 1, 0 } +}; + +/** + * balanced + * + * Client Allocation: + * reservation: 50% | weight: 1 | limit: 0 (max) | + * Background Recovery Allocation: + * reservation: 50% | weight: 1 | limit: 0 (max) | + * Background Best Effort Allocation: + * reservation: 0 (min) | weight: 1 | limit: 90% | + */ +constexpr profile_t BALANCED{ + { .5, 1, 0 }, + { .5, 1, 0 }, + { 0, 1, .9 } }; struct client_profile_id_t {