| 369 | } |
| 370 | |
| 371 | IGNORE_DEPRECATED |
| 372 | [[deprecated]] |
| 373 | int ErasureCode::_decode(const set<int> &want_to_read, |
| 374 | const map<int, bufferlist> &chunks, |
| 375 | map<int, bufferlist> *decoded) |
| 376 | { |
| 377 | vector<int> have; |
| 378 | have.reserve(chunks.size()); |
| 379 | for (map<int, bufferlist>::const_iterator i = chunks.begin(); |
| 380 | i != chunks.end(); |
| 381 | ++i) { |
| 382 | have.push_back(i->first); |
| 383 | } |
| 384 | if (includes( |
| 385 | have.begin(), have.end(), want_to_read.begin(), want_to_read.end())) { |
| 386 | for (set<int>::iterator i = want_to_read.begin(); |
| 387 | i != want_to_read.end(); |
| 388 | ++i) { |
| 389 | (*decoded)[*i] = chunks.find(*i)->second; |
| 390 | } |
| 391 | return 0; |
| 392 | } |
| 393 | unsigned int k = get_data_chunk_count(); |
| 394 | unsigned int m = get_chunk_count() - k; |
| 395 | unsigned blocksize = (*chunks.begin()).second.length(); |
| 396 | for (unsigned int i = 0; i < k + m; i++) { |
| 397 | if (chunks.find(i) == chunks.end()) { |
| 398 | bufferlist tmp; |
| 399 | bufferptr ptr(buffer::create_aligned(blocksize, SIMD_ALIGN)); |
| 400 | tmp.push_back(ptr); |
| 401 | tmp.claim_append((*decoded)[i]); |
| 402 | (*decoded)[i].swap(tmp); |
| 403 | } else { |
| 404 | (*decoded)[i] = chunks.find(i)->second; |
| 405 | (*decoded)[i].rebuild_aligned(SIMD_ALIGN); |
| 406 | } |
| 407 | } |
| 408 | return decode_chunks(want_to_read, chunks, decoded); |
| 409 | } |
| 410 | END_IGNORE_DEPRECATED |
| 411 | |
| 412 | int ErasureCode::_decode(const shard_id_set &want_to_read, |
nothing calls this directly
no test coverage detected