From 1315a1cb51068df5a7bf5b42785bce9a4253d21e Mon Sep 17 00:00:00 2001 From: Kamoltat Date: Mon, 28 Feb 2022 21:38:34 +0000 Subject: [PATCH] osd/osd_types: reorder pg_num_max moved `pg_num_max` to be at the end of the list in src/osd/osd_types.cc and src/osd/osd_types.h. Added comments to `opt_mapping` and `pool_opts_t` about the importance of the order of options in the list and class. Fixes: https://tracker.ceph.com/issues/54263 Signed-off-by: Kamoltat (cherry picked from commit e44c469f59eaef18ecd3c3b348981939043eae02) --- src/osd/osd_types.cc | 9 ++++++--- src/osd/osd_types.h | 5 ++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index 62a4a4d3dd5fa..f74082f2523e0 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -1312,6 +1312,9 @@ void pool_snap_info_t::generate_test_instances(list& o) // -- pool_opts_t -- +// The order of items in the list is important, therefore, +// you should always add to the end of the list when adding new options. + typedef std::map opt_mapping_t; static opt_mapping_t opt_mapping = boost::assign::map_list_of ("scrub_min_interval", pool_opts_t::opt_desc_t( @@ -1346,8 +1349,6 @@ static opt_mapping_t opt_mapping = boost::assign::map_list_of pool_opts_t::FINGERPRINT_ALGORITHM, pool_opts_t::STR)) ("pg_num_min", pool_opts_t::opt_desc_t( pool_opts_t::PG_NUM_MIN, pool_opts_t::INT)) - ("pg_num_max", pool_opts_t::opt_desc_t( - pool_opts_t::PG_NUM_MAX, pool_opts_t::INT)) ("target_size_bytes", pool_opts_t::opt_desc_t( pool_opts_t::TARGET_SIZE_BYTES, pool_opts_t::INT)) ("target_size_ratio", pool_opts_t::opt_desc_t( @@ -1361,7 +1362,9 @@ static opt_mapping_t opt_mapping = boost::assign::map_list_of ("dedup_chunk_algorithm", pool_opts_t::opt_desc_t( pool_opts_t::DEDUP_CHUNK_ALGORITHM, pool_opts_t::STR)) ("dedup_cdc_chunk_size", pool_opts_t::opt_desc_t( - pool_opts_t::DEDUP_CDC_CHUNK_SIZE, pool_opts_t::INT)); + pool_opts_t::DEDUP_CDC_CHUNK_SIZE, pool_opts_t::INT)) + ("pg_num_max", pool_opts_t::opt_desc_t( + pool_opts_t::PG_NUM_MAX, pool_opts_t::INT)); bool pool_opts_t::is_opt_name(const std::string& name) { diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index 6b1f32569557c..93645c5f218c7 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -1039,6 +1039,9 @@ inline std::ostream& operator<<(std::ostream& out, const pool_snap_info_t& si) { * pool options. */ +// The order of items in the list is important, therefore, +// you should always add to the end of the list when adding new options. + class pool_opts_t { public: enum key_t { @@ -1058,7 +1061,6 @@ public: CSUM_MIN_BLOCK, FINGERPRINT_ALGORITHM, PG_NUM_MIN, // min pg_num - PG_NUM_MAX, // max pg_num TARGET_SIZE_BYTES, // total bytes in pool TARGET_SIZE_RATIO, // fraction of total cluster PG_AUTOSCALE_BIAS, @@ -1066,6 +1068,7 @@ public: DEDUP_TIER, DEDUP_CHUNK_ALGORITHM, DEDUP_CDC_CHUNK_SIZE, + PG_NUM_MAX, // max pg_num }; enum type_t { -- 2.39.5