]> 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, 18 Feb 2026 15:41:48 +0000 (15:41 +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.

Fixes: https://tracker.ceph.com/issues/74813
Signed-off-by: Alex Ainscow <aainscow@uk.ibm.com>
(cherry picked from commit 442b45295f707b8d155caf5d1d51afd4664900db)

src/mon/OSDMonitor.cc

index 451bf7aa9e010d10102b8083819c9c31db09e417..530a329930961346694996288fdda1b5ebce29ad 100644 (file)
@@ -8391,12 +8391,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();
@@ -8410,6 +8411,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
@@ -8915,7 +8923,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;
     }