]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
erasure-code: Add plugin flag to indicate if plugins require sub chunks
authorJon Bailey <jonathan.bailey1@ibm.com>
Tue, 11 Feb 2025 09:59:24 +0000 (09:59 +0000)
committerAlex Ainscow <aainscow@uk.ibm.com>
Wed, 19 Mar 2025 11:03:56 +0000 (11:03 +0000)
Signed-off-by: Jon Bailey <jonathan.bailey1@ibm.com>
src/erasure-code/ErasureCodeInterface.h
src/erasure-code/clay/ErasureCodeClay.h
src/test/erasure-code/TestErasureCodePlugins.cc

index f57c0a1d41f3f685c61f8037228f5ae757137ddc..2be9387f2d1b3fc83d0bf69a014b20ff677040d9 100644 (file)
@@ -565,6 +565,10 @@ namespace ceph {
        * data chunk and the coding parity chunks.
        */
       FLAG_EC_PLUGIN_PARITY_DELTA_OPTIMIZATION = 1<<4,
+      /* This plugin requires sub-chunks (at the time of writing this was only
+       * clay). Other plugins will not process the overhead of stub sub-chunks.
+       */
+      FLAG_EC_PLUGIN_REQUIRE_SUB_CHUNKS = 1<<5,
     };
     static const char *get_optimization_flag_name(const plugin_flags flag) {
       switch (flag) {
@@ -573,6 +577,7 @@ namespace ceph {
       case FLAG_EC_PLUGIN_ZERO_INPUT_ZERO_OUTPUT_OPTIMIZATION: return "zeroinout";
       case FLAG_EC_PLUGIN_ZERO_PADDING_OPTIMIZATION: return "zeropadding";
       case FLAG_EC_PLUGIN_PARITY_DELTA_OPTIMIZATION: return "paritydelta";
+      case FLAG_EC_PLUGIN_REQUIRE_SUB_CHUNKS: return "requiresubchunks";
       default: return "???";
       }
     }
index 77216cd922e707d3a286562e48a6b9bc9f298273..500ff2d5eff16c6bb90152258057e2424c2f0570 100644 (file)
@@ -52,10 +52,10 @@ public:
       // the corner case of m = 1
       return FLAG_EC_PLUGIN_PARTIAL_READ_OPTIMIZATION |
        FLAG_EC_PLUGIN_PARTIAL_WRITE_OPTIMIZATION |
-       FLAG_EC_PLUGIN_ZERO_INPUT_ZERO_OUTPUT_OPTIMIZATION;
+        FLAG_EC_PLUGIN_REQUIRE_SUB_CHUNKS;
     }
     return FLAG_EC_PLUGIN_PARTIAL_READ_OPTIMIZATION |
-      FLAG_EC_PLUGIN_ZERO_INPUT_ZERO_OUTPUT_OPTIMIZATION;
+      FLAG_EC_PLUGIN_REQUIRE_SUB_CHUNKS;
   }
 
   unsigned int get_chunk_count() const override {
index cd656c8f5f86cc220682e6ed7516fdf5cccc9726..dac02af88ebf2f5c5c9ddb4573fa5b07c988602c 100644 (file)
@@ -455,6 +455,19 @@ TEST_P(PluginTest,MinimumGranularity)
     EXPECT_EQ(erasure_code->get_minimum_granularity(), 1);
   }
 }
+TEST_P(PluginTest,SubChunkSupport)
+{
+  initialize();
+
+  /* If any configurations of the plugin support !=1 sub chunk, then sub-chunk
+   * support must be enabled.  Setting the flag unnecessarily is not-ideal, but
+   * is a performance penalty.
+   */
+  if (erasure_code->get_sub_chunk_count() != 1) {
+    ASSERT_TRUE((erasure_code->get_supported_optimizations() &
+        ErasureCodeInterface::FLAG_EC_PLUGIN_REQUIRE_SUB_CHUNKS) != 0);
+  }
+}
 INSTANTIATE_TEST_SUITE_P(
   PluginTests,
   PluginTest,