@@ -8357,6 +8357,8 @@ int OSDMonitor::prepare_new_pool(string& name,
83578357 enable_pool_ec_optimizations (*pi, nullptr , true );
83588358 }
83598359
8360+ enable_pool_ec_direct_reads (*pi);
8361+
83608362 pending_inc.new_pool_names [pool] = name;
83618363 return 0 ;
83628364}
@@ -8451,6 +8453,29 @@ int OSDMonitor::enable_pool_ec_optimizations(pg_pool_t &p,
84518453 return 0 ;
84528454}
84538455
8456+ void OSDMonitor::enable_pool_ec_direct_reads (pg_pool_t &p) {
8457+ if (p.is_erasure ()) {
8458+ ErasureCodeInterfaceRef erasure_code;
8459+ stringstream tmp;
8460+ int err = get_erasure_code (p.erasure_code_profile , &erasure_code, &tmp);
8461+
8462+ // Once this feature is finished, we will replace this with upgrade code.
8463+ // The upgrade code will enable the split read flag once all OSDs are at
8464+ // Umbrella. For now, if the plugin does not support direct reads, we just
8465+ // disable it. All plugins and techniques should be capable of supporting
8466+ // direct reads, but we put in place this capability to reduce the test
8467+ // matrix for less important plugins/techniques.
8468+ //
8469+ // To enable direct reads in development, set the osd_pool_default_flags to
8470+ // 1<<20 = 0x100000 = 1048576
8471+ if (err != 0 || !p.allows_ecoptimizations () ||
8472+ (erasure_code->get_supported_optimizations () &
8473+ ErasureCodeInterface::FLAG_EC_PLUGIN_DIRECT_READS) == 0 ) {
8474+ p.flags &= ~pg_pool_t ::FLAG_CLIENT_SPLIT_READS;
8475+ }
8476+ }
8477+ }
8478+
84548479int OSDMonitor::prepare_command_pool_set (const cmdmap_t & cmdmap,
84558480 stringstream& ss)
84568481{
0 commit comments