]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common/mclock_common: move profile defaults to header
authorSamuel Just <sjust@redhat.com>
Thu, 7 Aug 2025 15:47:19 +0000 (08:47 -0700)
committerSamuel Just <sjust@redhat.com>
Tue, 2 Sep 2025 16:18:02 +0000 (16:18 +0000)
Signed-off-by: Samuel Just <sjust@redhat.com>
src/common/mclock_common.cc
src/common/mclock_common.h

index f560813939eb888ebf7695910e4dfa240cd0b348..d53e410192c418a1cd7ea65c58295fc3db3bf5c0 100644 (file)
@@ -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<std::string>("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;
index 331f61bdfdd392ba2281a431dc013f5790f816be..7a679f2c923f99c591c09588ad0f040552160e3b 100644 (file)
@@ -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 {