| 65 | } |
| 66 | |
| 67 | int ErasureCodeJerasure::parse(ErasureCodeProfile &profile, |
| 68 | ostream *ss) |
| 69 | { |
| 70 | int err = ErasureCode::parse(profile, ss); |
| 71 | err |= to_int("k", profile, &k, DEFAULT_K, ss); |
| 72 | err |= to_int("m", profile, &m, DEFAULT_M, ss); |
| 73 | err |= to_int("w", profile, &w, DEFAULT_W, ss); |
| 74 | if (chunk_mapping.size() > 0 && (int)chunk_mapping.size() != k + m) { |
| 75 | *ss << "mapping " << profile.find("mapping")->second |
| 76 | << " maps " << chunk_mapping.size() << " chunks instead of" |
| 77 | << " the expected " << k + m << " and will be ignored" << std::endl; |
| 78 | chunk_mapping.clear(); |
| 79 | err = -EINVAL; |
| 80 | } |
| 81 | err |= sanity_check_k_m(k, m, ss); |
| 82 | return err; |
| 83 | } |
| 84 | |
| 85 | unsigned int ErasureCodeJerasure::get_chunk_size(unsigned int stripe_width) const |
| 86 | { |