* to decode a parity CRC to get the CRC of a data shard.
*/
FLAG_EC_PLUGIN_CRC_ENCODE_DECODE_SUPPORT = 1<<7,
+ /* This plugin supports the ability for the client to read directly from
+ * the OSD containing a shard. This currently requires that raw shard ==
+ * shard and that the data shards are simply striped.
+ */
+ FLAG_EC_PLUGIN_DIRECT_READS = 1<<8,
};
static const char *get_optimization_flag_name(const plugin_flags flag) {
switch (flag) {
case FLAG_EC_PLUGIN_OPTIMIZED_SUPPORTED: return "optimizedsupport";
case FLAG_EC_PLUGIN_CRC_ENCODE_DECODE_SUPPORT:
return "crcencodedecode";
+ case FLAG_EC_PLUGIN_DIRECT_READS:
+ return "directreads";
default: return "???";
}
}
FLAG_EC_PLUGIN_PARTIAL_READ_OPTIMIZATION |
FLAG_EC_PLUGIN_PARTIAL_WRITE_OPTIMIZATION |
FLAG_EC_PLUGIN_ZERO_INPUT_ZERO_OUTPUT_OPTIMIZATION |
- FLAG_EC_PLUGIN_PARITY_DELTA_OPTIMIZATION;
+ FLAG_EC_PLUGIN_PARITY_DELTA_OPTIMIZATION |
+ FLAG_EC_PLUGIN_DIRECT_READS;
if (technique == "reed_sol_van"sv) {
flags |= FLAG_EC_PLUGIN_CRC_ENCODE_DECODE_SUPPORT;
flags = FLAG_EC_PLUGIN_PARTIAL_READ_OPTIMIZATION |
FLAG_EC_PLUGIN_PARTIAL_WRITE_OPTIMIZATION |
FLAG_EC_PLUGIN_ZERO_INPUT_ZERO_OUTPUT_OPTIMIZATION |
- FLAG_EC_PLUGIN_PARITY_DELTA_OPTIMIZATION;
+ FLAG_EC_PLUGIN_PARITY_DELTA_OPTIMIZATION |
+ FLAG_EC_PLUGIN_DIRECT_READS;
if (technique == "reed_sol_van"sv) {
flags |= FLAG_EC_PLUGIN_OPTIMIZED_SUPPORTED;
enable_pool_ec_optimizations(*pi, nullptr, true);
}
+ enable_pool_ec_direct_reads(*pi);
+
pending_inc.new_pool_names[pool] = name;
return 0;
}
return 0;
}
+void OSDMonitor::enable_pool_ec_direct_reads(pg_pool_t &p) {
+ if (p.is_erasure()) {
+ ErasureCodeInterfaceRef erasure_code;
+ stringstream tmp;
+ int err = get_erasure_code(p.erasure_code_profile, &erasure_code, &tmp);
+
+ // Once this feature is finished, we will replace this with upgrade code.
+ // The upgrade code will enable the split read flag once all OSDs are at
+ // Umbrella. For now, if the plugin does not support direct reads, we just
+ // disable it. All plugins and techniques should be capable of supporting
+ // direct reads, but we put in place this capability to reduce the test
+ // matrix for less important plugins/techniques.
+ //
+ // To enable direct reads in development, set the osd_pool_default_flags to
+ // 1<<20 = 0x100000 = 1048576
+ if (err != 0 || !p.allows_ecoptimizations() ||
+ (erasure_code->get_supported_optimizations() &
+ ErasureCodeInterface::FLAG_EC_PLUGIN_DIRECT_READS) == 0) {
+ p.flags &= ~pg_pool_t::FLAG_CLIENT_SPLIT_READS;
+ }
+ }
+}
+
int OSDMonitor::prepare_command_pool_set(const cmdmap_t& cmdmap,
stringstream& ss)
{
int enable_pool_ec_optimizations(pg_pool_t &pool,
std::stringstream *ss,
bool enable);
+ void enable_pool_ec_direct_reads(pg_pool_t &p);
int prepare_command_pool_set(const cmdmap_t& cmdmap,
std::stringstream& ss);
ErasureCodeInterface::FLAG_EC_PLUGIN_CRC_ENCODE_DECODE_SUPPORT) != 0;
}
+ bool supports_direct_reads() const {
+ return (plugin_flags &
+ ErasureCodeInterface::FLAG_EC_PLUGIN_DIRECT_READS) != 0;
+ }
+
uint64_t get_stripe_width() const {
return stripe_width;
}
// Note, does not prohibit being created on classic osd.
FLAG_CRIMSON = 1<<18,
FLAG_EC_OPTIMIZATIONS = 1<<19, // enable optimizations, once enabled, cannot be disabled
+ FLAG_CLIENT_SPLIT_READS = 1<<20, // Optimized EC is permitted to do direct reads.
};
static const char *get_flag_name(uint64_t f) {