Skip to content

Commit bf2e074

Browse files
JonBailey1993aainscow
authored andcommitted
erasure-code: Add plugin flag to indicate if plugins require sub chunks
Signed-off-by: Jon Bailey <[email protected]>
1 parent 77fa266 commit bf2e074

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

src/erasure-code/ErasureCodeInterface.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,10 @@ namespace ceph {
565565
* data chunk and the coding parity chunks.
566566
*/
567567
FLAG_EC_PLUGIN_PARITY_DELTA_OPTIMIZATION = 1<<4,
568+
/* This plugin requires sub-chunks (at the time of writing this was only
569+
* clay). Other plugins will not process the overhead of stub sub-chunks.
570+
*/
571+
FLAG_EC_PLUGIN_REQUIRE_SUB_CHUNKS = 1<<5,
568572
};
569573
static const char *get_optimization_flag_name(const plugin_flags flag) {
570574
switch (flag) {
@@ -573,6 +577,7 @@ namespace ceph {
573577
case FLAG_EC_PLUGIN_ZERO_INPUT_ZERO_OUTPUT_OPTIMIZATION: return "zeroinout";
574578
case FLAG_EC_PLUGIN_ZERO_PADDING_OPTIMIZATION: return "zeropadding";
575579
case FLAG_EC_PLUGIN_PARITY_DELTA_OPTIMIZATION: return "paritydelta";
580+
case FLAG_EC_PLUGIN_REQUIRE_SUB_CHUNKS: return "requiresubchunks";
576581
default: return "???";
577582
}
578583
}

src/erasure-code/clay/ErasureCodeClay.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ class ErasureCodeClay final : public ceph::ErasureCode {
5252
// the corner case of m = 1
5353
return FLAG_EC_PLUGIN_PARTIAL_READ_OPTIMIZATION |
5454
FLAG_EC_PLUGIN_PARTIAL_WRITE_OPTIMIZATION |
55-
FLAG_EC_PLUGIN_ZERO_INPUT_ZERO_OUTPUT_OPTIMIZATION;
55+
FLAG_EC_PLUGIN_REQUIRE_SUB_CHUNKS;
5656
}
5757
return FLAG_EC_PLUGIN_PARTIAL_READ_OPTIMIZATION |
58-
FLAG_EC_PLUGIN_ZERO_INPUT_ZERO_OUTPUT_OPTIMIZATION;
58+
FLAG_EC_PLUGIN_REQUIRE_SUB_CHUNKS;
5959
}
6060

6161
unsigned int get_chunk_count() const override {

src/test/erasure-code/TestErasureCodePlugins.cc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,19 @@ TEST_P(PluginTest,MinimumGranularity)
455455
EXPECT_EQ(erasure_code->get_minimum_granularity(), 1);
456456
}
457457
}
458+
TEST_P(PluginTest,SubChunkSupport)
459+
{
460+
initialize();
461+
462+
/* If any configurations of the plugin support !=1 sub chunk, then sub-chunk
463+
* support must be enabled. Setting the flag unnecessarily is not-ideal, but
464+
* is a performance penalty.
465+
*/
466+
if (erasure_code->get_sub_chunk_count() != 1) {
467+
ASSERT_TRUE((erasure_code->get_supported_optimizations() &
468+
ErasureCodeInterface::FLAG_EC_PLUGIN_REQUIRE_SUB_CHUNKS) != 0);
469+
}
470+
}
458471
INSTANTIATE_TEST_SUITE_P(
459472
PluginTests,
460473
PluginTest,

0 commit comments

Comments
 (0)