* 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) {
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 "???";
}
}
// 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 {
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,