| 383 | } |
| 384 | |
| 385 | void |
| 386 | StripeSM::updateLiveData([[maybe_unused]] enum Copy c) |
| 387 | { |
| 388 | // CacheStoreBlocks delta{_meta_pos[c][FOOT] - _meta_pos[c][HEAD]}; |
| 389 | CacheStoreBlocks header_len(0); |
| 390 | // int64_t n_buckets; |
| 391 | // int64_t n_segments; |
| 392 | |
| 393 | /* |
| 394 | * COMMENTING THIS SECTION FOR NOW TO USE THE EXACT LOGIN USED IN ATS TO CALCULATE THE NUMBER OF SEGMENTS AND BUCKETS |
| 395 | // Past the header is the segment free list heads which if sufficiently long (> ~4K) can take |
| 396 | // more than 1 store block. Start with a guess of 1 and adjust upwards as needed. A 2TB stripe |
| 397 | // with an AOS of 8000 has roughly 3700 segments meaning that for even 10TB drives this loop |
| 398 | // should only be a few iterations. |
| 399 | do { |
| 400 | ++header_len; |
| 401 | n_buckets = Bytes(delta - header_len) / (sizeof(CacheDirEntry) * ts::ENTRIES_PER_BUCKET); |
| 402 | n_segments = n_buckets / ts::MAX_BUCKETS_PER_SEGMENT; |
| 403 | // This should never be more than one loop, usually none. |
| 404 | while ((n_buckets / n_segments) > ts::MAX_BUCKETS_PER_SEGMENT) |
| 405 | ++n_segments; |
| 406 | } while ((sizeof(StripeMeta) + sizeof(uint16_t) * n_segments) > static_cast<size_t>(header_len)); |
| 407 | |
| 408 | _buckets = n_buckets / n_segments; |
| 409 | _segments = n_segments; |
| 410 | */ |
| 411 | _directory._skip = header_len; |
| 412 | } |
| 413 | |
| 414 | bool |
| 415 | dir_compare_tag(const CacheDirEntry *e, const CryptoHash *key) |