From a114d1bdeaef3e019847a21787f7deb85a90ca7e Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Thu, 14 Nov 2024 12:29:49 -0500 Subject: [PATCH] client: sort configs Signed-off-by: Patrick Donnelly Fixes: https://tracker.ceph.com/issues/66373 (cherry picked from commit a84c396e7d34fc5af676f4dc4fdb0d81b2e84a3c) --- src/client/Client.cc | 42 +++++++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/src/client/Client.cc b/src/client/Client.cc index 81e8ef2591d53..b0d93d39a32bc 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -17330,21 +17330,33 @@ void Client::set_cap_epoch_barrier(epoch_t e) const char** Client::get_tracked_conf_keys() const { - static const char* keys[] = { - "client_cache_size", - "client_cache_mid", - "client_acl_type", - "client_deleg_timeout", - "client_deleg_break_on_open", - "client_oc_size", - "client_oc_max_objects", - "client_oc_max_dirty", - "client_oc_target_dirty", - "client_oc_max_dirty_age", - "client_caps_release_delay", - "client_mount_timeout", - NULL - }; +#define KEYS \ + "client_acl_type", \ + "client_cache_mid", \ + "client_cache_size", \ + "client_caps_release_delay", \ + "client_deleg_break_on_open", \ + "client_deleg_timeout", \ + "client_mount_timeout", \ + "client_oc_max_dirty", \ + "client_oc_max_dirty_age", \ + "client_oc_max_objects", \ + "client_oc_size", \ + "client_oc_target_dirty" \ + + constexpr bool is_sorted = [] () constexpr { + constexpr auto arr = std::to_array({KEYS}); + for (unsigned long i = 0; i < arr.size()-1; ++i) { + if (arr[i] > arr[i+1]) { + return false; + } + } + return true; + }(); + static_assert(is_sorted, "keys are not sorted!"); + + static char const* keys[] = {KEYS, nullptr}; + return keys; } -- 2.39.5