]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Get chunk size for consistency checking from EC profile instead of command line arg
authorConnor Fawcett <connorfa@uk.ibm.com>
Thu, 17 Jul 2025 01:19:16 +0000 (02:19 +0100)
committerConnor Fawcett <connorfa@uk.ibm.com>
Thu, 17 Jul 2025 01:29:46 +0000 (02:29 +0100)
Signed-off-by: Connor Fawcett <connorfa@uk.ibm.com>
src/erasure-code/consistency/ConsistencyChecker.cc
src/erasure-code/consistency/ConsistencyChecker.h
src/erasure-code/consistency/RadosCommands.cc
src/erasure-code/consistency/RadosCommands.h
src/erasure-code/consistency/ceph_ec_consistency_checker.cc

index 1957e5263a7eed154ed6b063d54d73772e44a4d7..da84ce1a8d1b8b4daf843edc40cfb4703c4de0aa 100644 (file)
@@ -14,8 +14,7 @@ using bufferlist = ceph::bufferlist;
 
 ConsistencyChecker::ConsistencyChecker(librados::Rados &rados,
                                        boost::asio::io_context& asio,
-                                       const std::string& pool_name,
-                                       int stripe_unit) :
+                                       const std::string& pool_name) :
   rados(rados),
   asio(asio),
   reader(ceph::consistency::ECReader(rados, asio, pool_name)),
@@ -24,7 +23,7 @@ ConsistencyChecker::ConsistencyChecker(librados::Rados &rados,
        commands.get_ec_profile_for_pool(pool_name),
        commands.get_pool_allow_ec_optimizations(pool_name)),
   encoder(ceph::consistency::ECEncoderSwitch(pool.get_ec_profile(),
-                                             stripe_unit,
+                                             commands.get_ec_chunk_size_for_pool(pool_name),
                                              commands.get_pool_allow_ec_optimizations(pool_name)
                                             )) {}
 
index dd2ee657d901c104fe1802c87debfbf9ce6e9bfa..666ca958d3685abf1f24c9f40ab137a1bbcd5b77 100644 (file)
@@ -52,8 +52,7 @@ class ConsistencyChecker {
   public:
     ConsistencyChecker(librados::Rados& rados,
                         boost::asio::io_context& asio,
-                        const std::string& pool_name,
-                        int stripe_unit);
+                        const std::string& pool_name);
     void queue_ec_read(Read read);
     bool check_object_consistency(const std::string& oid,
                                   const bufferlist& inbl);
index 145ce35e7a298635ed1b0408ff5d3defb02a34aa..8fb97587f1f8a77e9c342c81623d248ed702c768 100644 (file)
@@ -137,7 +137,19 @@ ceph::ErasureCodeProfile RadosCommands::get_ec_profile_for_pool(const std::strin
 }
 
 /**
- * RadosCommands the parity read inject on the acting primary
+ * Get chunk size for pool with the supplied name
+ *
+ * @param pool_name string Name of the pool to get chunk size of
+ * @return int the chunk size of the pool
+ */
+int RadosCommands::get_ec_chunk_size_for_pool(const std::string& pool_name)
+{
+  ceph::ErasureCodeProfile profile = get_ec_profile_for_pool(pool_name);
+  return (profile.contains("stripe_unit") ? std::stol(profile["stripe_unit"]) : 4096);
+}
+
+/**
+ * Inject the parity read inject on the acting primary
  * for the specified object and pool. Assert on failure.
  *
  * @param pool_name string Name of the pool to perform inject on
index e24e81e3263a8b4f87a5598906d81da5a572788b..89b7eb06f858867ef8dfcc88f3c726510401a798 100644 (file)
@@ -24,6 +24,7 @@ class RadosCommands {
     std::string get_pool_ec_profile_name(const std::string& pool_name);
     bool get_pool_allow_ec_optimizations(const std::string& pool_name);
     ceph::ErasureCodeProfile get_ec_profile_for_pool(const std::string& pool_name);
+    int get_ec_chunk_size_for_pool(const std::string& pool_name);
     void inject_parity_read_on_primary_osd(const std::string& pool_name,
                                            const std::string& oid);
     void inject_clear_parity_read_on_primary_osd(const std::string& pool_name,
index 58a3e0b1f712dd82c74cb2b83c192685bb3d8550..35606084b2ae4b24c93c4d33eb9671cbd6300f4d 100644 (file)
@@ -35,8 +35,7 @@ int main(int argc, char **argv)
     ("oid,i", po::value<std::string>(), "object io")
     ("blocksize,b", po::value<int>(), "block size")
     ("offset,o", po::value<int>(), "offset")
-    ("length,l", po::value<int>(), "length")
-    ("stripeunit,s", po::value<int>(), "stripe unit");
+    ("length,l", po::value<int>(), "length");
 
   po::variables_map vm;
   std::vector<std::string> unrecognized_options;
@@ -62,7 +61,6 @@ int main(int argc, char **argv)
   auto blocksize = vm["blocksize"].as<int>();
   auto offset = vm["offset"].as<int>();
   auto length = vm["length"].as<int>();
-  auto stripe_unit = vm["stripeunit"].as<int>();
 
   int rc;
   rc = rados.init_with_context(g_ceph_context);
@@ -73,7 +71,7 @@ int main(int argc, char **argv)
   guard.emplace(boost::asio::make_work_guard(asio));
   thread = make_named_thread("io_thread",[&asio] { asio.run(); });
 
-  auto checker = ceph::consistency::ConsistencyChecker(rados, asio, pool, stripe_unit);
+  auto checker = ceph::consistency::ConsistencyChecker(rados, asio, pool);
   checker.single_read_and_check_consistency(oid, blocksize, offset, length);
   checker.print_results(std::cout);