]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mon: Deny EC optimizations (fast EC) for non-4k-aligned chunk-sizes.
authorAlex Ainscow <aainscow@uk.ibm.com>
Wed, 11 Feb 2026 18:11:12 +0000 (18:11 +0000)
committerAlex Ainscow <aainscow@uk.ibm.com>
Wed, 11 Feb 2026 20:04:16 +0000 (20:04 +0000)
There are some bugs in the way Fast EC handles non 4k-aligned chunk sizes.

Such chunk sizes are buggy and even if they did work, the performance
would not be very good.  Storage efficiency is also not helped by these
unusual encodings.

This commit will reject any attempt to turn optimizations (fast EC) on.

If the default is set to turn optimizations on, then this will be ignored
if the profile is not 4k aligned.

Note that to create a profile in the first place requires a --force override.

Signed-off-by: Alex Ainscow <aainscow@uk.ibm.com>
src/mon/OSDMonitor.cc

index c71a66c853abda66b2564ec8ae97e7f587b45e7a..3e6948ab00744eb17e0ad50621aadd3f9a544186 100644 (file)
@@ -8407,12 +8407,13 @@ int OSDMonitor::enable_pool_ec_optimizations(pg_pool_t &p,
   }
   if (enable) {
     ErasureCodeInterfaceRef erasure_code;
-    unsigned int k, m;
+    unsigned int k, m, chunk_size;
     stringstream tmp;
     int err = get_erasure_code(p.erasure_code_profile, &erasure_code, &tmp);
     if (err == 0) {
       k = erasure_code->get_data_chunk_count();
       m = erasure_code->get_coding_chunk_count();
+      chunk_size = erasure_code->get_chunk_size(p.get_stripe_width());
     } else {
       if (ss) {
         *ss << "get_erasure_code failed: " << tmp.str();
@@ -8426,6 +8427,13 @@ int OSDMonitor::enable_pool_ec_optimizations(pg_pool_t &p,
       }
       return -EINVAL;
     }
+
+    if ((chunk_size % 4096) != 0) {
+      if (ss) {
+        *ss << "stripe_unit must be divisible by 4096 to enable ec optimizations";
+      }
+      return -EINVAL;
+    }
     // Restrict the set of shards that can be a primary to the 1st data
     // raw_shard (raw_shard 0) and the coding parity raw_shards because§
     // the other shards (including local parity for LRC) may not have
@@ -8950,7 +8958,7 @@ int OSDMonitor::prepare_command_pool_set(const cmdmap_t& cmdmap,
       return -EINVAL;
     }
     bool was_enabled = p.allows_ecoptimizations();
-    int r = enable_pool_ec_optimizations(p, nullptr, enable);
+    int r = enable_pool_ec_optimizations(p, &ss, enable);
     if (r != 0) {
       return r;
     }