From: Alex Ainscow Date: Wed, 11 Feb 2026 18:11:12 +0000 (+0000) Subject: mon: Deny EC optimizations (fast EC) for non-4k-aligned chunk-sizes. X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7ed70925fd5fb4219af4416cfc8d52e6cc9d4eac;p=ceph-ci.git mon: Deny EC optimizations (fast EC) for non-4k-aligned chunk-sizes. 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 --- diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index c71a66c853a..3e6948ab007 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -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; }