| 473 | } |
| 474 | |
| 475 | Errata |
| 476 | Cache::loadSpanDirect(swoc::file::path const &path, int vol_idx, [[maybe_unused]] const Bytes &size) |
| 477 | { |
| 478 | Errata zret; |
| 479 | std::unique_ptr<Span> span(new Span(path)); |
| 480 | zret = span->load(); |
| 481 | if (zret) { |
| 482 | if (span->_header) { |
| 483 | int nspb = span->_header->num_diskvol_blks; |
| 484 | for (auto i = 0; i < nspb; ++i) { |
| 485 | ts::CacheStripeDescriptor &raw = span->_header->stripes[i]; |
| 486 | StripeSM *stripe = new StripeSM(span.get(), raw.offset, raw.len); |
| 487 | stripe->_idx = i; |
| 488 | if (raw.free == 0) { |
| 489 | stripe->_vol_idx = raw.vol_idx; |
| 490 | stripe->_type = raw.type; |
| 491 | _volumes[stripe->_vol_idx]._stripes.push_back(stripe); |
| 492 | _volumes[stripe->_vol_idx]._size += stripe->_len; |
| 493 | stripe->vol_init_data(); |
| 494 | } else { |
| 495 | span->_free_space += stripe->_len; |
| 496 | } |
| 497 | span->_stripes.push_back(stripe); |
| 498 | globalVec_stripe.push_back(stripe); |
| 499 | } |
| 500 | span->_vol_idx = vol_idx; |
| 501 | } else { |
| 502 | span->clear(); |
| 503 | } |
| 504 | _spans.push_back(span.release()); |
| 505 | } |
| 506 | return zret; |
| 507 | } |
| 508 | |
| 509 | Errata |
| 510 | Cache::loadSpanConfig(swoc::file::path const &path) |