]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: allow PG splitting for crimson pools by default
authorAishwarya Mathuria <amathuri@redhat.com>
Thu, 29 Jan 2026 11:53:54 +0000 (11:53 +0000)
committerAishwarya Mathuria <amathuri@redhat.com>
Fri, 30 Jan 2026 05:45:30 +0000 (05:45 +0000)
Previously, crimson pools were created with FLAG_NOPGCHANGE hardcoded,
preventing any adjustment to pg_num since splitting and merging were
not yet supported.

This patch:
- Removes the hardcoded FLAG_NOPGCHANGE during crimson pool creation,
  and instead honors the global 'osd_pool_default_flag_nopgchange'.
- Introduces 'crimson_allow_pg_split' (default: true) to gate
  PG splitting.
- Explicitly blocks PG merging (shrinking) for crimson pools,
  as shrinking remains unsupported.

Signed-off-by: Aishwarya Mathuria <amathuri@redhat.com>
src/common/options/crimson.yaml.in
src/mon/OSDMonitor.cc

index 031113ae7f55965f0b28e888b27c66aa583f6548..ab4c5bcc33db2b5df674b0dfc60bce48750e5a56 100644 (file)
@@ -89,6 +89,17 @@ options:
   flags:
   - startup
 
+- name: crimson_allow_pg_split
+  type: bool
+  level: advanced
+  default: true
+  desc: Allow Crimson pools to increase their PG count (split)
+  long_desc: When enabled, allows the monitor to increase pg_num for pools using
+             the crimson flag.
+  services:
+  - osd
+  - mon
+
 # Bluestore options:
 
 - name: crimson_bluestore_num_threads
index c71a66c853abda66b2564ec8ae97e7f587b45e7a..1c746113ce9dc0fea9aaeda3c6df02e4bb5896bc 100644 (file)
@@ -8270,7 +8270,6 @@ int OSDMonitor::prepare_new_pool(string& name,
     pi->use_gmt_hitset = false;
   if (crimson) {
     pi->set_flag(pg_pool_t::FLAG_CRIMSON);
-    pi->set_flag(pg_pool_t::FLAG_NOPGCHANGE);
   }
 
   pi->size = size;
@@ -8626,6 +8625,18 @@ int OSDMonitor::prepare_command_pool_set(const cmdmap_t& cmdmap,
       ss << "pool pg_num change is disabled; you must unset nopgchange flag for the pool first";
       return -EPERM;
     }
+    // check for Crimson pools
+    // pg merging is not yet supported in Crimson
+    if (p.has_flag(pg_pool_t::FLAG_CRIMSON)) {
+      if (n < (int)p.get_pg_num()) {
+        ss << "crimson-osd does not support decreasing pg_num_actual (shrinking)";
+        return -ENOTSUP;
+      }
+      if (n > (int)p.get_pg_num() && !g_conf().get_val<bool>("crimson_allow_pg_split")) {
+        ss << "crimson_allow_pg_split is false; pg_num_actual increase denied";
+        return -EPERM;
+      }
+    }
     if (interr.length()) {
       ss << "error parsing integer value '" << val << "': " << interr;
       return -EINVAL;
@@ -8677,6 +8688,18 @@ int OSDMonitor::prepare_command_pool_set(const cmdmap_t& cmdmap,
       ss << "pool pg_num change is disabled; you must unset nopgchange flag for the pool first";
       return -EPERM;
     }
+    // check for Crimson pools
+    // pg merging is not yet supported in Crimson
+    if (p.has_flag(pg_pool_t::FLAG_CRIMSON)) {
+      if (n < (int)p.get_pg_num_target()) {
+        ss << "crimson-osd does not support decreasing pg_num";
+        return -ENOTSUP;
+      }
+      if (n > (int)p.get_pg_num_target() && !g_conf().get_val<bool>("crimson_allow_pg_split")) {
+        ss << "crimson_allow_pg_split is false; pg_num increase denied for crimson pool";
+        return -EPERM;
+      }
+    }
     if (interr.length()) {
       ss << "error parsing integer value '" << val << "': " << interr;
       return -EINVAL;
@@ -8746,6 +8769,18 @@ int OSDMonitor::prepare_command_pool_set(const cmdmap_t& cmdmap,
       ss << "pool pgp_num change is disabled; you must unset nopgchange flag for the pool first";
       return -EPERM;
     }
+    // check for Crimson pools
+    // pg merging is not yet supported in Crimson
+    if (p.has_flag(pg_pool_t::FLAG_CRIMSON)) {
+      if (n < (int)p.get_pgp_num()) {
+        ss << "crimson-osd does not support decreasing pgp_num_actual";
+        return -ENOTSUP;
+      }
+      if (n > (int)p.get_pgp_num() && !g_conf().get_val<bool>("crimson_allow_pg_split")) {
+        ss << "crimson_allow_pg_split is false; pgp_num_actual increase denied";
+        return -EPERM;
+      }
+    }
     if (interr.length()) {
       ss << "error parsing integer value '" << val << "': " << interr;
       return -EINVAL;
@@ -8769,6 +8804,18 @@ int OSDMonitor::prepare_command_pool_set(const cmdmap_t& cmdmap,
       ss << "pool pgp_num change is disabled; you must unset nopgchange flag for the pool first";
       return -EPERM;
     }
+    // check for Crimson pools
+    // pg merging is not yet supported in Crimson
+    if (p.has_flag(pg_pool_t::FLAG_CRIMSON)) {
+      if (n < (int)p.get_pgp_num_target()) {
+        ss << "crimson-osd does not support decreasing pgp_num";
+        return -ENOTSUP;
+      }
+      if (n > (int)p.get_pgp_num_target() && !g_conf().get_val<bool>("crimson_allow_pg_split")) {
+        ss << "crimson_allow_pg_split is false; pgp_num increase denied";
+        return -EPERM;
+      }
+    }
     if (interr.length()) {
       ss << "error parsing integer value '" << val << "': " << interr;
       return -EINVAL;