Skip to content

Commit ac8816c

Browse files
committed
osd: Introduce pool flag for "split IO" and Plugin flag for "direct read"
These flags will currently behave as follows: 1. The pool flag is never set, unless by a user with the osd_pool_default_flags config option. 2. The pool flag will be removed for EC pools where the plugin does not support direct reads. 3. Replica pools will never remove the flag. The intention is to eventually invert this logic and allow split IOs upon upgrade to Umberella in this same function. Signed-off-by: Alex Ainscow <[email protected]>
1 parent 8b8c88a commit ac8816c

File tree

7 files changed

+43
-2
lines changed

7 files changed

+43
-2
lines changed

src/erasure-code/ErasureCodeInterface.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,11 @@ namespace ceph {
685685
* to decode a parity CRC to get the CRC of a data shard.
686686
*/
687687
FLAG_EC_PLUGIN_CRC_ENCODE_DECODE_SUPPORT = 1<<7,
688+
/* This plugin supports the ability for the client to read directly from
689+
* the OSD containing a shard. This currently requires that raw shard ==
690+
* shard and that the data shards are simply striped.
691+
*/
692+
FLAG_EC_PLUGIN_DIRECT_READS = 1<<8,
688693
};
689694
static const char *get_optimization_flag_name(const plugin_flags flag) {
690695
switch (flag) {
@@ -697,6 +702,8 @@ namespace ceph {
697702
case FLAG_EC_PLUGIN_OPTIMIZED_SUPPORTED: return "optimizedsupport";
698703
case FLAG_EC_PLUGIN_CRC_ENCODE_DECODE_SUPPORT:
699704
return "crcencodedecode";
705+
case FLAG_EC_PLUGIN_DIRECT_READS:
706+
return "directreads";
700707
default: return "???";
701708
}
702709
}

src/erasure-code/isa/ErasureCodeIsa.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ class ErasureCodeIsa : public ceph::ErasureCode {
6969
FLAG_EC_PLUGIN_PARTIAL_READ_OPTIMIZATION |
7070
FLAG_EC_PLUGIN_PARTIAL_WRITE_OPTIMIZATION |
7171
FLAG_EC_PLUGIN_ZERO_INPUT_ZERO_OUTPUT_OPTIMIZATION |
72-
FLAG_EC_PLUGIN_PARITY_DELTA_OPTIMIZATION;
72+
FLAG_EC_PLUGIN_PARITY_DELTA_OPTIMIZATION |
73+
FLAG_EC_PLUGIN_DIRECT_READS;
7374

7475
if (technique == "reed_sol_van"sv) {
7576
flags |= FLAG_EC_PLUGIN_CRC_ENCODE_DECODE_SUPPORT;

src/erasure-code/jerasure/ErasureCodeJerasure.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ class ErasureCodeJerasure : public ceph::ErasureCode {
5151
flags = FLAG_EC_PLUGIN_PARTIAL_READ_OPTIMIZATION |
5252
FLAG_EC_PLUGIN_PARTIAL_WRITE_OPTIMIZATION |
5353
FLAG_EC_PLUGIN_ZERO_INPUT_ZERO_OUTPUT_OPTIMIZATION |
54-
FLAG_EC_PLUGIN_PARITY_DELTA_OPTIMIZATION;
54+
FLAG_EC_PLUGIN_PARITY_DELTA_OPTIMIZATION |
55+
FLAG_EC_PLUGIN_DIRECT_READS;
5556

5657
if (technique == "reed_sol_van"sv) {
5758
flags |= FLAG_EC_PLUGIN_OPTIMIZED_SUPPORTED;

src/mon/OSDMonitor.cc

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
84548479
int OSDMonitor::prepare_command_pool_set(const cmdmap_t& cmdmap,
84558480
stringstream& ss)
84568481
{

src/mon/OSDMonitor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,7 @@ class OSDMonitor : public PaxosService,
745745
int enable_pool_ec_optimizations(pg_pool_t &pool,
746746
std::stringstream *ss,
747747
bool enable);
748+
void enable_pool_ec_direct_reads(pg_pool_t &p);
748749
int prepare_command_pool_set(const cmdmap_t& cmdmap,
749750
std::stringstream& ss);
750751

src/osd/ECUtil.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,11 @@ class stripe_info_t {
683683
ErasureCodeInterface::FLAG_EC_PLUGIN_CRC_ENCODE_DECODE_SUPPORT) != 0;
684684
}
685685

686+
bool supports_direct_reads() const {
687+
return (plugin_flags &
688+
ErasureCodeInterface::FLAG_EC_PLUGIN_DIRECT_READS) != 0;
689+
}
690+
686691
uint64_t get_stripe_width() const {
687692
return stripe_width;
688693
}

src/osd/osd_types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,6 +1331,7 @@ struct pg_pool_t {
13311331
// Note, does not prohibit being created on classic osd.
13321332
FLAG_CRIMSON = 1<<18,
13331333
FLAG_EC_OPTIMIZATIONS = 1<<19, // enable optimizations, once enabled, cannot be disabled
1334+
FLAG_CLIENT_SPLIT_READS = 1<<20, // Optimized EC is permitted to do direct reads.
13341335
};
13351336

13361337
static const char *get_flag_name(uint64_t f) {

0 commit comments

Comments
 (0)