MCPcopy Create free account
hub / github.com/ceph/ceph / parse

Method parse

src/erasure-code/isa/ErasureCodeIsa.cc:583–633  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

581// -----------------------------------------------------------------------------
582
583int ErasureCodeIsaDefault::parse(ErasureCodeProfile &profile,
584 ostream *ss)
585{
586 int err = ErasureCode::parse(profile, ss);
587 err |= to_int("k", profile, &k, DEFAULT_K, ss);
588 err |= to_int("m", profile, &m, DEFAULT_M, ss);
589 err |= sanity_check_k_m(k, m, ss);
590
591 if (m > MAX_M) {
592 *ss << "isa: m=" << m << " should be less/equal than " << MAX_M
593 << " : revert to m=" << MAX_M << std::endl;
594 m = MAX_M;
595 err = -EINVAL;
596 }
597
598 if (matrixtype == kVandermonde) {
599 // these are verified safe values evaluated using the
600 // benchmarktool and 10*(combinatoric for maximum loss) random
601 // full erasures
602 if (k > MAX_K) {
603 *ss << "Vandermonde: k=" << k
604 << " should be less/equal than " << MAX_K
605 << " : revert to k=" << MAX_K << std::endl;
606 k = MAX_K;
607 err = -EINVAL;
608 }
609
610 if (m > 4) {
611 *ss << "Vandermonde: m=" << m
612 << " should be less than 5 to guarantee an MDS codec:"
613 << " switching to Cauchy technique" << std::endl;
614 matrixtype = kCauchy;
615 profile["technique"] = "cauchy"sv;
616 }
617 switch (m) {
618 case 4:
619 if (k > 21) {
620 *ss << "Vandermonde: k=" << k
621 << " should be less than 22 to guarantee an MDS"
622 << " codec with m=4: switching"
623 << " to Cauchy technique" << std::endl;
624 matrixtype = kCauchy;
625 profile["technique"] = "cauchy"sv;
626 }
627 break;
628 default:
629 ;
630 }
631 }
632 return err;
633}
634
635// -----------------------------------------------------------------------------
636

Callers

nothing calls this directly

Calls 2

to_intFunction · 0.85
parseFunction · 0.50

Tested by

no test coverage detected